MCPcopy
hub / github.com/caddyserver/caddy / TestReplaceCertificatePaths

Function TestReplaceCertificatePaths

caddytest/caddytest_test.go:10–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestReplaceCertificatePaths(t *testing.T) {
11 rawConfig := `a.caddy.localhost:9443 {
12 tls /caddy.localhost.crt /caddy.localhost.key {
13 }
14
15 redir / https://b.caddy.localhost:9443/version 301
16
17 respond /version 200 {
18 body "hello from a.caddy.localhost"
19 }
20 }`
21
22 r := prependCaddyFilePath(rawConfig)
23
24 if !strings.Contains(r, getIntegrationDir()+"/caddy.localhost.crt") {
25 t.Error("expected the /caddy.localhost.crt to be expanded to include the full path")
26 }
27
28 if !strings.Contains(r, getIntegrationDir()+"/caddy.localhost.key") {
29 t.Error("expected the /caddy.localhost.crt to be expanded to include the full path")
30 }
31
32 if !strings.Contains(r, "https://b.caddy.localhost:9443/version") {
33 t.Error("expected redirect uri to be unchanged")
34 }
35}
36
37func TestLoadUnorderedJSON(t *testing.T) {
38 tester := NewTester(t)

Callers

nothing calls this directly

Calls 3

prependCaddyFilePathFunction · 0.85
getIntegrationDirFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected