diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-08-10 21:05:17 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-08-12 13:26:32 +0200 |
commit | 9e571827055dedb46b78c5db3d17d6913f14870b (patch) | |
tree | f5f0108afe0c9385ff6dc27664943d9f719f57ad /config/privacy | |
parent | 6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff) | |
download | hugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip |
tests: Convert from testify to quicktest
Diffstat (limited to 'config/privacy')
-rw-r--r-- | config/privacy/privacyConfig_test.go | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/config/privacy/privacyConfig_test.go b/config/privacy/privacyConfig_test.go index 5ced6d9d9..d798721e1 100644 --- a/config/privacy/privacyConfig_test.go +++ b/config/privacy/privacyConfig_test.go @@ -16,13 +16,13 @@ package privacy import ( "testing" + qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/config" "github.com/spf13/viper" - "github.com/stretchr/testify/require" ) func TestDecodeConfigFromTOML(t *testing.T) { - assert := require.New(t) + c := qt.New(t) tomlConfig := ` @@ -52,30 +52,27 @@ privacyEnhanced = true simple = true ` cfg, err := config.FromConfigString(tomlConfig, "toml") - assert.NoError(err) + c.Assert(err, qt.IsNil) pc, err := DecodeConfig(cfg) - assert.NoError(err) - assert.NotNil(pc) - - assert.True(pc.Disqus.Disable) - assert.True(pc.GoogleAnalytics.Disable) - assert.True(pc.GoogleAnalytics.RespectDoNotTrack) - assert.True(pc.GoogleAnalytics.AnonymizeIP) - assert.True(pc.GoogleAnalytics.UseSessionStorage) - assert.True(pc.Instagram.Disable) - assert.True(pc.Instagram.Simple) - assert.True(pc.Twitter.Disable) - assert.True(pc.Twitter.EnableDNT) - assert.True(pc.Twitter.Simple) - assert.True(pc.Vimeo.Disable) - assert.True(pc.Vimeo.Simple) - assert.True(pc.YouTube.PrivacyEnhanced) - assert.True(pc.YouTube.Disable) + c.Assert(err, qt.IsNil) + c.Assert(pc, qt.Not(qt.IsNil)) + + got := []bool{ + pc.Disqus.Disable, pc.GoogleAnalytics.Disable, + pc.GoogleAnalytics.RespectDoNotTrack, pc.GoogleAnalytics.AnonymizeIP, + pc.GoogleAnalytics.UseSessionStorage, pc.Instagram.Disable, + pc.Instagram.Simple, pc.Twitter.Disable, pc.Twitter.EnableDNT, + pc.Twitter.Simple, pc.Vimeo.Disable, pc.Vimeo.Simple, + pc.YouTube.PrivacyEnhanced, pc.YouTube.Disable, + } + + c.Assert(got, qt.All(qt.Equals), true) + } func TestDecodeConfigFromTOMLCaseInsensitive(t *testing.T) { - assert := require.New(t) + c := qt.New(t) tomlConfig := ` @@ -86,19 +83,19 @@ someOtherValue = "foo" PrivacyENhanced = true ` cfg, err := config.FromConfigString(tomlConfig, "toml") - assert.NoError(err) + c.Assert(err, qt.IsNil) pc, err := DecodeConfig(cfg) - assert.NoError(err) - assert.NotNil(pc) - assert.True(pc.YouTube.PrivacyEnhanced) + c.Assert(err, qt.IsNil) + c.Assert(pc, qt.Not(qt.IsNil)) + c.Assert(pc.YouTube.PrivacyEnhanced, qt.Equals, true) } func TestDecodeConfigDefault(t *testing.T) { - assert := require.New(t) + c := qt.New(t) pc, err := DecodeConfig(viper.New()) - assert.NoError(err) - assert.NotNil(pc) - assert.False(pc.YouTube.PrivacyEnhanced) + c.Assert(err, qt.IsNil) + c.Assert(pc, qt.Not(qt.IsNil)) + c.Assert(pc.YouTube.PrivacyEnhanced, qt.Equals, false) } |