Spring test cleaning, take 2

This commit is contained in:
Bjørn Erik Pedersen
2018-03-17 19:24:02 +01:00
parent debd3663dd
commit da88015776
6 changed files with 172 additions and 159 deletions

View File

@@ -14,30 +14,19 @@
package hugolib
import (
"path/filepath"
"testing"
"github.com/gohugoio/hugo/deps"
)
func Test404(t *testing.T) {
t.Parallel()
var (
cfg, fs = newTestCfg()
th = testHelper{cfg, fs, t}
)
cfg.Set("baseURL", "http://auth/bub/")
writeSource(t, fs, filepath.Join("layouts", "404.html"), "<html><body>Not Found!</body></html>")
writeSource(t, fs, filepath.Join("content", "page.md"), "A page")
buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
b := newTestSitesBuilder(t)
b.WithSimpleConfigFile().WithTemplatesAdded("404.html", "<html><body>Not Found!</body></html>")
b.Build(BuildCfg{})
// Note: We currently have only 1 404 page. One might think that we should have
// multiple, to follow the Custom Output scheme, but I don't see how that wold work
// multiple, to follow the Custom Output scheme, but I don't see how that would work
// right now.
th.assertFileContent("public/404.html", "Not Found")
b.AssertFileContent("public/404.html", "Not Found")
}