mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
@@ -30,7 +30,6 @@ import (
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
|
||||
"github.com/gohugoio/hugo/common/constants"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
|
||||
@@ -92,7 +91,7 @@ func (ns *Namespace) GetCSV(sep string, args ...any) (d [][]string, err error) {
|
||||
if security.IsAccessDenied(err) {
|
||||
return nil, err
|
||||
}
|
||||
ns.deps.Log.(loggers.IgnorableLogger).Errorsf(constants.ErrRemoteGetCSV, "Failed to get CSV resource %q: %s", url, err)
|
||||
ns.deps.Log.Errorsf(constants.ErrRemoteGetCSV, "Failed to get CSV resource %q: %s", url, err)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -128,7 +127,7 @@ func (ns *Namespace) GetJSON(args ...any) (any, error) {
|
||||
if security.IsAccessDenied(err) {
|
||||
return nil, err
|
||||
}
|
||||
ns.deps.Log.(loggers.IgnorableLogger).Errorsf(constants.ErrRemoteGetJSON, "Failed to get JSON resource %q: %s", url, err)
|
||||
ns.deps.Log.Errorsf(constants.ErrRemoteGetJSON, "Failed to get JSON resource %q: %s", url, err)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/bep/logg"
|
||||
"github.com/gohugoio/hugo/common/maps"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
@@ -108,13 +109,13 @@ func TestGetCSV(t *testing.T) {
|
||||
got, err := ns.GetCSV(test.sep, test.url)
|
||||
|
||||
if _, ok := test.expect.(bool); ok {
|
||||
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 1)
|
||||
c.Assert(int(ns.deps.Log.LoggCount(logg.LevelError)), qt.Equals, 1)
|
||||
c.Assert(got, qt.IsNil)
|
||||
return
|
||||
}
|
||||
|
||||
c.Assert(err, qt.IsNil, msg)
|
||||
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 0)
|
||||
c.Assert(int(ns.deps.Log.LoggCount(logg.LevelError)), qt.Equals, 0)
|
||||
c.Assert(got, qt.Not(qt.IsNil), msg)
|
||||
c.Assert(got, qt.DeepEquals, test.expect, msg)
|
||||
})
|
||||
@@ -200,11 +201,11 @@ func TestGetJSON(t *testing.T) {
|
||||
got, _ := ns.GetJSON(test.url)
|
||||
|
||||
if _, ok := test.expect.(bool); ok {
|
||||
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 1)
|
||||
c.Assert(int(ns.deps.Log.LoggCount(logg.LevelError)), qt.Equals, 1)
|
||||
return
|
||||
}
|
||||
|
||||
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 0, msg)
|
||||
c.Assert(int(ns.deps.Log.LoggCount(logg.LevelError)), qt.Equals, 0, msg)
|
||||
c.Assert(got, qt.Not(qt.IsNil), msg)
|
||||
c.Assert(got, qt.DeepEquals, test.expect)
|
||||
|
||||
@@ -283,7 +284,7 @@ func TestHeaders(t *testing.T) {
|
||||
err := fn("http://example.org/api", "?foo", test.headers)
|
||||
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 0)
|
||||
c.Assert(int(ns.deps.Log.LoggCount(logg.LevelError)), qt.Equals, 0)
|
||||
test.assert(c, headers.String())
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,9 @@ package data
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@@ -29,7 +32,6 @@ import (
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
"github.com/gohugoio/hugo/cache/filecache"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
@@ -182,7 +184,7 @@ func TestScpGetRemoteParallel(t *testing.T) {
|
||||
|
||||
func newDeps(cfg config.Provider) *deps.Deps {
|
||||
conf := testconfig.GetTestConfig(nil, cfg)
|
||||
logger := loggers.NewIgnorableLogger(loggers.NewErrorLogger(), nil)
|
||||
logger := loggers.NewDefault()
|
||||
fs := hugofs.NewFrom(afero.NewMemMapFs(), conf.BaseConfig())
|
||||
|
||||
d := &deps.Deps{
|
||||
|
Reference in New Issue
Block a user