diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-12-21 10:35:33 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-12-22 11:35:53 +0100 |
commit | 6779117f72e2d92f708cff2bfc004d2cfd7d068b (patch) | |
tree | 1c6f9243575e95756bf68942a8c40a835e76bbe0 /hugolib/resource_chain_test.go | |
parent | ce04011096456c77479fa98a6ceee242aeac7919 (diff) |
media: Also consider extension in FromContent
As used in `resources.GetRemote`.
This will now reject image files with text and text files with images.
Diffstat (limited to 'hugolib/resource_chain_test.go')
-rw-r--r-- | hugolib/resource_chain_test.go | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go index 131bce40f..8b17b01a4 100644 --- a/hugolib/resource_chain_test.go +++ b/hugolib/resource_chain_test.go @@ -22,16 +22,15 @@ import ( "net/http" "net/http/httptest" "os" - - "github.com/gohugoio/hugo/config" - - "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" - "path/filepath" "strings" "testing" "time" + "github.com/gohugoio/hugo/config" + + "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" + jww "github.com/spf13/jwalterweatherman" "github.com/gohugoio/hugo/common/herrors" @@ -57,7 +56,6 @@ func TestSCSSWithIncludePaths(t *testing.T) { {"libsass", func() bool { return scss.Supports() }}, {"dartsass", func() bool { return dartsass.Supports() }}, } { - c.Run(test.name, func(c *qt.C) { if !test.supports() { c.Skip(fmt.Sprintf("Skip %s", test.name)) @@ -107,9 +105,7 @@ T1: {{ $r.Content }} b.AssertFileContent(filepath.Join(workDir, "public/index.html"), `T1: moo{color:#fff}`) }) - } - } func TestSCSSWithRegularCSSImport(t *testing.T) { @@ -122,7 +118,6 @@ func TestSCSSWithRegularCSSImport(t *testing.T) { {"libsass", func() bool { return scss.Supports() }}, {"dartsass", func() bool { return dartsass.Supports() }}, } { - c.Run(test.name, func(c *qt.C) { if !test.supports() { c.Skip(fmt.Sprintf("Skip %s", test.name)) @@ -202,11 +197,9 @@ moo { } /* foo */`) - } }) } - } func TestSCSSWithThemeOverrides(t *testing.T) { @@ -219,7 +212,6 @@ func TestSCSSWithThemeOverrides(t *testing.T) { {"libsass", func() bool { return scss.Supports() }}, {"dartsass", func() bool { return dartsass.Supports() }}, } { - c.Run(test.name, func(c *qt.C) { if !test.supports() { c.Skip(fmt.Sprintf("Skip %s", test.name)) @@ -319,7 +311,6 @@ T1: {{ $r.Content }} ) }) } - } // https://github.com/gohugoio/hugo/issues/6274 @@ -333,7 +324,6 @@ func TestSCSSWithIncludePathsSass(t *testing.T) { {"libsass", func() bool { return scss.Supports() }}, {"dartsass", func() bool { return dartsass.Supports() }}, } { - c.Run(test.name, func(c *qt.C) { if !test.supports() { c.Skip(fmt.Sprintf("Skip %s", test.name)) @@ -620,6 +610,7 @@ func TestResourceChains(t *testing.T) { return case "/authenticated/": + w.Header().Set("Content-Type", "text/plain") if r.Header.Get("Authorization") == "Bearer abcd" { w.Write([]byte(`Welcome`)) return @@ -628,6 +619,7 @@ func TestResourceChains(t *testing.T) { return case "/post": + w.Header().Set("Content-Type", "text/plain") if r.Method == http.MethodPost { body, err := ioutil.ReadAll(r.Body) if err != nil { @@ -1247,8 +1239,8 @@ class-in-b { // TODO(bep) for some reason, we have starting to get // execute of template failed: template: index.html:5:25 // on CI (GitHub action). - //b.Assert(fe.Position().LineNumber, qt.Equals, 5) - //b.Assert(fe.Error(), qt.Contains, filepath.Join(workDir, "assets/css/components/b.css:4:1")) + // b.Assert(fe.Position().LineNumber, qt.Equals, 5) + // b.Assert(fe.Error(), qt.Contains, filepath.Join(workDir, "assets/css/components/b.css:4:1")) // Remove PostCSS b.Assert(os.RemoveAll(filepath.Join(workDir, "node_modules")), qt.IsNil) |