aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/sitemap_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2016-07-28 09:30:58 +0200
committerBjørn Erik Pedersen <[email protected]>2016-09-06 18:32:16 +0300
commit708bc78770a0b0361908f6404f57264c53252a95 (patch)
tree9b7e3a05b1e83a768bfa0dd96b61b07dd7917cfd /hugolib/sitemap_test.go
parentf023dfd7636f73b11c94e86a05c6273941d52c58 (diff)
downloadhugo-708bc78770a0b0361908f6404f57264c53252a95.tar.gz
hugo-708bc78770a0b0361908f6404f57264c53252a95.zip
Optimize the multilanguage build process
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
Diffstat (limited to 'hugolib/sitemap_test.go')
-rw-r--r--hugolib/sitemap_test.go29
1 files changed, 6 insertions, 23 deletions
diff --git a/hugolib/sitemap_test.go b/hugolib/sitemap_test.go
index c508fbc31..58408ce47 100644
--- a/hugolib/sitemap_test.go
+++ b/hugolib/sitemap_test.go
@@ -37,37 +37,20 @@ const SITEMAP_TEMPLATE = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap
</urlset>`
func TestSitemapOutput(t *testing.T) {
- viper.Reset()
- defer viper.Reset()
-
- hugofs.InitMemFs()
+ testCommonResetState()
viper.Set("baseurl", "http://auth/bub/")
s := &Site{
- Source: &source.InMemorySource{ByteSource: weightedSources},
- Lang: newDefaultLanguage(),
- }
-
- s.initializeSiteInfo()
-
- s.prepTemplates("sitemap.xml", SITEMAP_TEMPLATE)
-
- createPagesAndMeta(t, s)
-
- if err := s.renderHomePage(); err != nil {
- t.Fatalf("Unable to RenderHomePage: %s", err)
- }
-
- if err := s.renderSitemap(); err != nil {
- t.Fatalf("Unable to RenderSitemap: %s", err)
+ Source: &source.InMemorySource{ByteSource: weightedSources},
+ Language: newDefaultLanguage(),
}
- if err := s.renderRobotsTXT(); err != nil {
- t.Fatalf("Unable to RenderRobotsTXT :%s", err)
+ if err := buildAndRenderSite(s, "sitemap.xml", SITEMAP_TEMPLATE); err != nil {
+ t.Fatalf("Failed to build site: %s", err)
}
- sitemapFile, err := hugofs.Destination().Open("sitemap.xml")
+ sitemapFile, err := hugofs.Destination().Open("public/sitemap.xml")
if err != nil {
t.Fatalf("Unable to locate: sitemap.xml")