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:
authorTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-09-30 15:05:27 +0300
committerTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-09-30 15:05:27 +0300
commitc69313b2ed71fbecd8acca283954dc3cfe424acb (patch)
tree63c4e2cbc80c82bcb7cd6181e13c2b2f3b6992a3 /internal/domain/domain_test.go
parentcee3464d6fe99efebac5f8d1b569f1301babdade (diff)
parentd07b803b6f8519566940843e389a6c2d73424a76 (diff)
Merge commit 'd07b803b6f8519566940843e389a6c2d73424a76' into auth
Diffstat (limited to 'internal/domain/domain_test.go')
-rw-r--r--internal/domain/domain_test.go30
1 files changed, 28 insertions, 2 deletions
diff --git a/internal/domain/domain_test.go b/internal/domain/domain_test.go
index 4c08aee5..de780197 100644
--- a/internal/domain/domain_test.go
+++ b/internal/domain/domain_test.go
@@ -31,6 +31,12 @@ func TestGroupServeHTTP(t *testing.T) {
testGroup := &D{
group: "group",
projectName: "",
+ projects: map[string]*project{
+ "group.test.io": &project{},
+ "group.gitlab-example.com": &project{},
+ "project": &project{},
+ "project2": &project{},
+ },
}
assert.HTTPBodyContains(t, serveFileOrNotFound(testGroup), "GET", "http://group.test.io/", nil, "main-dir")
@@ -205,6 +211,12 @@ func TestGroupServeHTTPGzip(t *testing.T) {
testGroup := &D{
group: "group",
projectName: "",
+ projects: map[string]*project{
+ "group.test.io": &project{},
+ "group.gitlab-example.com": &project{},
+ "project": &project{},
+ "project2": &project{},
+ },
}
testSet := []struct {
@@ -268,15 +280,24 @@ func TestGroup404ServeHTTP(t *testing.T) {
testGroup := &D{
group: "group.404",
projectName: "",
+ projects: map[string]*project{
+ "domain.404": &project{},
+ "group.404.test.io": &project{},
+ "project.404": &project{},
+ "project.404.symlink": &project{},
+ "project.no.404": &project{},
+ },
}
testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/project.404/not/existing-file", nil, "Custom 404 project page")
testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/project.404/", nil, "Custom 404 project page")
- testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/project.no.404/not/existing-file", nil, "Custom 404 group page")
testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/not/existing-file", nil, "Custom 404 group page")
testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/not-existing-file", nil, "Custom 404 group page")
testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/", nil, "Custom 404 group page")
assert.HTTPBodyNotContains(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/project.404.symlink/not/existing-file", nil, "Custom 404 project page")
+
+ // Ensure the namespace project's custom 404.html is not used by projects
+ testHTTP404(t, serveFileOrNotFound(testGroup), "GET", "http://group.404.test.io/project.no.404/not/existing-file", nil, "The page you're looking for could not be found.")
}
func TestDomain404ServeHTTP(t *testing.T) {
@@ -350,7 +371,12 @@ func TestDomainCertificate(t *testing.T) {
}
func TestCacheControlHeaders(t *testing.T) {
- testGroup := &D{group: "group"}
+ testGroup := &D{
+ group: "group",
+ projects: map[string]*project{
+ "group.test.io": &project{},
+ },
+ }
w := httptest.NewRecorder()
req, err := http.NewRequest("GET", "http://group.test.io/", nil)
require.NoError(t, err)