diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2020-10-21 11:52:51 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2020-10-21 11:52:51 +0300 |
commit | b382faeec6491bb544d33549570610a476f597b7 (patch) | |
tree | 19c7185b558848057a4956053bc7dde72c018ef3 /acceptance_test.go | |
parent | 05c6facd72644095ca1aeff88c564dfb411fe34f (diff) | |
parent | 517dcf8dbf11a6b6abbc1365cc456b5fbfe6436b (diff) |
Merge branch 'realFlowControl-master-patch-44819' into 'master'
#460 Upgrade go-mimedb to support new types including avif images
See merge request gitlab-org/gitlab-pages!353
Diffstat (limited to 'acceptance_test.go')
-rw-r--r-- | acceptance_test.go | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/acceptance_test.go b/acceptance_test.go index 69ec8742..28dc7bd4 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -643,21 +643,35 @@ func TestPageNotAvailableIfNotLoaded(t *testing.T) { require.Equal(t, http.StatusServiceUnavailable, rsp.StatusCode) } -func TestObscureMIMEType(t *testing.T) { +func TestMIMETypes(t *testing.T) { skipUnlessEnabled(t) teardown := RunPagesProcessWithoutWait(t, *pagesBinary, listeners, "") defer teardown() require.NoError(t, httpListener.WaitUntilRequestSucceeds(nil)) - rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "project/file.webmanifest") - require.NoError(t, err) - defer rsp.Body.Close() + tests := map[string]struct { + file string + expectedContentType string + }{ + "manifest_json": { + file: "file.webmanifest", + expectedContentType: "application/manifest+json", + }, + } - require.Equal(t, http.StatusOK, rsp.StatusCode) - mt, _, err := mime.ParseMediaType(rsp.Header.Get("Content-Type")) - require.NoError(t, err) - require.Equal(t, "application/manifest+json", mt) + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "project/"+tt.file) + require.NoError(t, err) + defer rsp.Body.Close() + + require.Equal(t, http.StatusOK, rsp.StatusCode) + mt, _, err := mime.ParseMediaType(rsp.Header.Get("Content-Type")) + require.NoError(t, err) + require.Equal(t, tt.expectedContentType, mt) + }) + } } func TestCompressedEncoding(t *testing.T) { |