diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-12-21 09:39:05 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-12-22 11:35:53 +0100 |
commit | cdc73526a80de2120df7aa44f7dc820df6de789d (patch) | |
tree | 2463ba37d6da3421726c48ff2bb4b1a5df067f2c /media/mediaType_test.go | |
parent | 425c7d90f0422f41703a757e97a1370d3b08fc37 (diff) |
media: Add PDF MIME type
Diffstat (limited to 'media/mediaType_test.go')
-rw-r--r-- | media/mediaType_test.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/media/mediaType_test.go b/media/mediaType_test.go index f3a06e8ed..8c739813d 100644 --- a/media/mediaType_test.go +++ b/media/mediaType_test.go @@ -51,6 +51,7 @@ func TestDefaultTypes(t *testing.T) { {XMLType, "application", "xml", "xml", "application/xml", "application/xml"}, {TOMLType, "application", "toml", "toml", "application/toml", "application/toml"}, {YAMLType, "application", "yaml", "yaml", "application/yaml", "application/yaml"}, + {PDFType, "application", "pdf", "pdf", "application/pdf", "application/pdf"}, {TrueTypeFontType, "font", "ttf", "ttf", "font/ttf", "font/ttf"}, {OpenTypeFontType, "font", "otf", "otf", "font/otf", "font/otf"}, } { @@ -62,7 +63,7 @@ func TestDefaultTypes(t *testing.T) { } - c.Assert(len(DefaultTypes), qt.Equals, 30) + c.Assert(len(DefaultTypes), qt.Equals, 31) } func TestGetByType(t *testing.T) { @@ -118,7 +119,8 @@ func TestGetFirstBySuffix(t *testing.T) { c.Assert(found, qt.Equals, true) c.Assert(f, qt.Equals, SuffixInfo{ Suffix: suffix, - FullSuffix: "." + suffix}) + FullSuffix: "." + suffix, + }) c.Assert(t, qt.Equals, expectedType) } @@ -126,7 +128,6 @@ func TestGetFirstBySuffix(t *testing.T) { check("json", JSONType) check("geojson", geoJSON) check("gjson", geoJSON) - } func TestFromTypeString(t *testing.T) { @@ -150,7 +151,6 @@ func TestFromTypeString(t *testing.T) { c.Assert(err, qt.IsNil) c.Assert(f, qt.Equals, Type{MainType: "text", SubType: "xml", mimeSuffix: ""}) - } func TestFromStringAndExt(t *testing.T) { @@ -178,7 +178,6 @@ func TestFromExtensionMultipleSuffixes(t *testing.T) { c.Assert(found, qt.Equals, true) c.Assert(ftp.String(), qt.Equals, "image/svg+xml") c.Assert(found, qt.Equals, true) - } func TestFromContent(t *testing.T) { @@ -189,7 +188,8 @@ func TestFromContent(t *testing.T) { mtypes := DefaultTypes for _, filename := range files { - c.Run(filepath.Base(filename), func(c *qt.C) { + name := filepath.Base(filename) + c.Run(name, func(c *qt.C) { content, err := ioutil.ReadFile(filename) c.Assert(err, qt.IsNil) ext := strings.TrimPrefix(paths.Ext(filename), ".") @@ -252,7 +252,6 @@ func TestDecodeTypes(t *testing.T) { _, found = tt.GetByType("application/hugo+hg") c.Assert(found, qt.Equals, true) - }, }, { |