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:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2021-09-16 01:26:18 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2022-01-24 15:11:56 +0300
commitad64a1b4ebf66d20ae18386e0566b8cfa2362565 (patch)
tree66cac9d45e4328313f6fc491c24387a07cf27d7e /internal
parent88656e8f55e74ea5d7adf703e36dac23726a139b (diff)
test: add malformed acme middleware url test
Diffstat (limited to 'internal')
-rw-r--r--internal/acme/acme_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/acme/acme_test.go b/internal/acme/acme_test.go
index 0ee9e6fc..1c3025d9 100644
--- a/internal/acme/acme_test.go
+++ b/internal/acme/acme_test.go
@@ -39,12 +39,17 @@ var (
domainWithChallenge = &domainStub{hasAcmeChallenge: true}
domain = &domainStub{hasAcmeChallenge: false}
middleware = &Middleware{GitlabURL: "https://gitlab.example.com"}
+ middlewareMalformed = &Middleware{GitlabURL: ":foo"}
)
func TestServeAcmeChallengesNotConfigured(t *testing.T) {
require.HTTPStatusCode(t, serveAcmeOrNotFound(nil, domain), http.MethodGet, challengeURL, nil, http.StatusNotFound)
}
+func TestServeAcmeChallengeMalformed(t *testing.T) {
+ require.HTTPStatusCode(t, serveAcmeOrNotFound(middlewareMalformed, domain), http.MethodGet, challengeURL, nil, http.StatusNotFound)
+}
+
func TestServeAcmeChallengeWhenPresent(t *testing.T) {
require.HTTPStatusCode(t, serveAcmeOrNotFound(middleware, domainWithChallenge), http.MethodGet, challengeURL, nil, http.StatusNotFound)
}