summaryrefslogtreecommitdiff
path: root/caddytest/caddytest_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'caddytest/caddytest_test.go')
-rw-r--r--caddytest/caddytest_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/caddytest/caddytest_test.go b/caddytest/caddytest_test.go
new file mode 100644
index 0000000..a46867c
--- /dev/null
+++ b/caddytest/caddytest_test.go
@@ -0,0 +1,33 @@
+package caddytest
+
+import (
+ "strings"
+ "testing"
+)
+
+func TestReplaceCertificatePaths(t *testing.T) {
+ rawConfig := `a.caddy.localhost:9443 {
+ tls /caddy.localhost.crt /caddy.localhost.key {
+ }
+
+ redir / https://b.caddy.localhost:9443/version 301
+
+ respond /version 200 {
+ body "hello from a.caddy.localhost"
+ }
+ }`
+
+ r := prependCaddyFilePath(rawConfig)
+
+ if !strings.Contains(r, getIntegrationDir()+"/caddy.localhost.crt") {
+ t.Error("expected the /caddy.localhost.crt to be expanded to include the full path")
+ }
+
+ if !strings.Contains(r, getIntegrationDir()+"/caddy.localhost.key") {
+ t.Error("expected the /caddy.localhost.crt to be expanded to include the full path")
+ }
+
+ if !strings.Contains(r, "https://b.caddy.localhost:9443/version") {
+ t.Error("expected redirect uri to be unchanged")
+ }
+}