diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-10 21:05:17 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-12 13:26:32 +0200 |
commit | 9e571827055dedb46b78c5db3d17d6913f14870b (patch) | |
tree | f5f0108afe0c9385ff6dc27664943d9f719f57ad /commands/server_test.go | |
parent | 6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff) | |
download | hugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip |
tests: Convert from testify to quicktest
Diffstat (limited to 'commands/server_test.go')
-rw-r--r-- | commands/server_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/commands/server_test.go b/commands/server_test.go index acee19cb8..8bd96c6ec 100644 --- a/commands/server_test.go +++ b/commands/server_test.go @@ -24,8 +24,8 @@ import ( "github.com/gohugoio/hugo/helpers" + qt "github.com/frankban/quicktest" "github.com/spf13/viper" - "github.com/stretchr/testify/require" ) func TestServer(t *testing.T) { @@ -33,9 +33,9 @@ func TestServer(t *testing.T) { // TODO(bep) not sure why server tests have started to fail on the Windows CI server. t.Skip("Skip server test on appveyor") } - assert := require.New(t) + c := qt.New(t) dir, err := createSimpleTestSite(t, testSiteConfig{}) - assert.NoError(err) + c.Assert(err, qt.IsNil) // Let us hope that this port is available on all systems ... port := 1331 @@ -54,7 +54,7 @@ func TestServer(t *testing.T) { go func() { _, err = cmd.ExecuteC() - assert.NoError(err) + c.Assert(err, qt.IsNil) }() // There is no way to know exactly when the server is ready for connections. @@ -63,12 +63,12 @@ func TestServer(t *testing.T) { time.Sleep(2 * time.Second) resp, err := http.Get("http://localhost:1331/") - assert.NoError(err) + c.Assert(err, qt.IsNil) defer resp.Body.Close() homeContent := helpers.ReaderToString(resp.Body) - assert.Contains(homeContent, "List: Hugo Commands") - assert.Contains(homeContent, "Environment: development") + c.Assert(homeContent, qt.Contains, "List: Hugo Commands") + c.Assert(homeContent, qt.Contains, "Environment: development") // Stop the server. stop <- true @@ -118,14 +118,14 @@ func TestFixURL(t *testing.T) { } func TestRemoveErrorPrefixFromLog(t *testing.T) { - assert := require.New(t) + c := qt.New(t) content := `ERROR 2018/10/07 13:11:12 Error while rendering "home": template: _default/baseof.html:4:3: executing "main" at <partial "logo" .>: error calling partial: template: partials/logo.html:5:84: executing "partials/logo.html" at <$resized.AHeight>: can't evaluate field AHeight in type *resource.Image ERROR 2018/10/07 13:11:12 Rebuild failed: logged 1 error(s) ` withoutError := removeErrorPrefixFromLog(content) - assert.False(strings.Contains(withoutError, "ERROR"), withoutError) + c.Assert(strings.Contains(withoutError, "ERROR"), qt.Equals, false) } |