diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-06-03 14:22:03 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-03 14:22:03 +0300 |
commit | 9df35356572e09dc2c0907113bf64479204e46a9 (patch) | |
tree | 70297534cace3ad4c6015df32757690cc9244992 /internal/host/host_test.go | |
parent | 80fa0bb4e200a6b3b9194766dd209de28d1cf08a (diff) |
Redirect unknown ACME challenges to the GitLab instance
Diffstat (limited to 'internal/host/host_test.go')
-rw-r--r-- | internal/host/host_test.go | 18 |
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))) +} |