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,10 +14,9 @@
package hugolib
import (
"path/filepath"
"testing"
"github.com/gohugoio/hugo/deps"
"github.com/spf13/viper"
)
const robotTxtTemplate = `User-agent: Googlebot
@@ -28,19 +27,16 @@ const robotTxtTemplate = `User-agent: Googlebot
func TestRobotsTXTOutput(t *testing.T) {
t.Parallel()
var (
cfg, fs = newTestCfg()
th = testHelper{cfg, fs, t}
)
cfg := viper.New()
cfg.Set("baseURL", "http://auth/bub/")
cfg.Set("enableRobotsTXT", true)
writeSource(t, fs, filepath.Join("layouts", "robots.txt"), robotTxtTemplate)
writeSourcesToSource(t, "content", fs, weightedSources...)
b := newTestSitesBuilder(t).WithViper(cfg)
b.WithTemplatesAdded("layouts/robots.txt", robotTxtTemplate)
buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
b.Build(BuildCfg{})
th.assertFileContent("public/robots.txt", "User-agent: Googlebot")
b.AssertFileContent("public/robots.txt", "User-agent: Googlebot")
}