From ed847ed93d86d0e1c0993adfee787e7fa02e604b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 17 Feb 2017 20:52:50 +0100 Subject: hugolib: Test helper cleanup --- hugolib/node_as_page_test.go | 134 +++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'hugolib/node_as_page_test.go') diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go index 64b9a2fd8..a7abd9728 100644 --- a/hugolib/node_as_page_test.go +++ b/hugolib/node_as_page_test.go @@ -58,7 +58,7 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { var ( cfg, fs = newTestCfg() - th = testHelper{cfg} + th = testHelper{cfg, fs, t} ) cfg.Set("uglyURLs", ugly) @@ -81,7 +81,7 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { // date order: home, sect1, sect2, cat/hugo, cat/web, categories - th.assertFileContent(t, fs, filepath.Join("public", "index.html"), false, + th.assertFileContent(filepath.Join("public", "index.html"), false, "Index Title: Home Sweet Home!", "Home Content!", "# Pages: 4", @@ -90,7 +90,7 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { "GetPage: Section1 ", ) - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "sect1", "regular1"), false, "Single Title: Page 01", "Content Page 01") + th.assertFileContent(expectedFilePath(ugly, "public", "sect1", "regular1"), false, "Single Title: Page 01", "Content Page 01") nodes := sites.findAllPagesByKindNotIn(KindPage) @@ -116,24 +116,24 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { require.True(t, first.IsPage()) // Check Home paginator - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "page", "2"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "page", "2"), false, "Pag: Page 02") // Check Sections - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "sect1"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "sect1"), false, "Section Title: Section", "Section1 Content!", "Date: 2009-01-04", "Lastmod: 2009-01-05", ) - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "sect2"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "sect2"), false, "Section Title: Section", "Section2 Content!", "Date: 2009-01-06", "Lastmod: 2009-01-07", ) // Check Sections paginator - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "sect1", "page", "2"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "sect1", "page", "2"), false, "Pag: Page 02") sections := sites.findAllPagesByKind(KindSection) @@ -141,13 +141,13 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { require.Len(t, sections, 2) // Check taxonomy lists - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "categories", "hugo"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "categories", "hugo"), false, "Taxonomy Title: Taxonomy Hugo", "Taxonomy Hugo Content!", "Date: 2009-01-08", "Lastmod: 2009-01-09", ) - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "categories", "hugo-rocks"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "categories", "hugo-rocks"), false, "Taxonomy Title: Taxonomy Hugo Rocks", ) @@ -157,7 +157,7 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { require.NotNil(t, web) require.Len(t, web.Data["Pages"].(Pages), 4) - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "categories", "web"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "categories", "web"), false, "Taxonomy Title: Taxonomy Web", "Taxonomy Web Content!", "Date: 2009-01-10", @@ -165,12 +165,12 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { ) // Check taxonomy list paginator - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "categories", "hugo", "page", "2"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "categories", "hugo", "page", "2"), false, "Taxonomy Title: Taxonomy Hugo", "Pag: Page 02") // Check taxonomy terms - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "categories"), false, + th.assertFileContent(expectedFilePath(ugly, "public", "categories"), false, "Taxonomy Terms Title: Taxonomy Term Categories", "Taxonomy Term Categories Content!", "k/v: hugo", "Date: 2009-01-14", "Lastmod: 2009-01-15", @@ -179,11 +179,11 @@ func doTestNodeAsPage(t *testing.T, ugly, preserveTaxonomyNames bool) { // There are no pages to paginate over in the taxonomy terms. // RSS - th.assertFileContent(t, fs, filepath.Join("public", "customrss.xml"), false, "Recent content in Home Sweet Home! on Hugo Rocks", "Content!") - th.assertFileContent(t, fs, filepath.Join("public", "de", "index.html"), true, + th.assertFileContent(filepath.Join("public", "de", "index.html"), true, "Index Title: Home Sweet Home!", "Content!") // Taxonomy list - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "nn", "categories", "hugo"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "nn", "categories", "hugo"), true, "Taxonomy Title: Hugo") - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "en", "categories", "hugo"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "en", "categories", "hugo"), true, "Taxonomy Title: Taxonomy Hugo") // Taxonomy terms - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "nn", "categories"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "nn", "categories"), true, "Taxonomy Terms Title: Categories") - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "en", "categories"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "en", "categories"), true, "Taxonomy Terms Title: Taxonomy Term Categories") // Sections - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "nn", "sect1"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "nn", "sect1"), true, "Section Title: Sect1s") - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "nn", "sect2"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "nn", "sect2"), true, "Section Title: Sect2s") - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "en", "sect1"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "en", "sect1"), true, "Section Title: Section1") - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "en", "sect2"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "en", "sect2"), true, "Section Title: Section2") // Regular pages - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "en", "sect1", "regular1"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "en", "sect1", "regular1"), true, "Single Title: Page 01") - th.assertFileContent(t, fs, expectedFilePath(ugly, "public", "nn", "sect1", "regular2"), true, + th.assertFileContent(expectedFilePath(ugly, "public", "nn", "sect1", "regular2"), true, "Single Title: Page 02") // RSS - th.assertFileContent(t, fs, filepath.Join("public", "nn", "customrss.xml"), true, "Hugo på norsk", "