Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Shushlin <vshushlin@gitlab.com>2019-06-03 14:22:03 +0300
committerNick Thomas <nick@gitlab.com>2019-06-03 14:22:03 +0300
commit9df35356572e09dc2c0907113bf64479204e46a9 (patch)
tree70297534cace3ad4c6015df32757690cc9244992 /internal/host/host_test.go
parent80fa0bb4e200a6b3b9194766dd209de28d1cf08a (diff)
Redirect unknown ACME challenges to the GitLab instance
Diffstat (limited to 'internal/host/host_test.go')
-rw-r--r--internal/host/host_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/host/host_test.go b/internal/host/host_test.go
new file mode 100644
index 00000000..8395d3fc
--- /dev/null
+++ b/internal/host/host_test.go
@@ -0,0 +1,18 @@
+package host
+
+import (
+ "net/http/httptest"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestFromString(t *testing.T) {
+ assert.Equal(t, "example.com", FromString("example.com"))
+ assert.Equal(t, "example.com", FromString("eXAmpLe.com"))
+ assert.Equal(t, "example.com", FromString("example.com:8080"))
+}
+
+func TestFromRequest(t *testing.T) {
+ assert.Equal(t, "example.com", FromRequest(httptest.NewRequest("GET", "example.com:8080/123", nil)))
+}