Exemple #1
0
 def test_root_article(self):
     """Test, that an article in the site root is built"""
     art = open("_articles/foo.html", "w")
     art.write("Title: Foo\n\n<p>Test</p>")
     art.close()
     build({"BUILD_TARGET": os.path.join(self.tmpdir, "site")})
     self.assertTrue(os.path.isfile("site/foo.html"), "article not built")
     c = open("site/foo.html")
     self.assertIn("Foo", c.read(), "article content wrong")
     c.close()
Exemple #2
0
 def test_minimal_article(self):
     """Test, that a minimal article is built"""
     art = open("_articles/foo.html", "w")
     art.write("\n\n")
     art.close()
     build({"BUILD_TARGET": os.path.join(self.tmpdir, "site")})
     self.assertTrue(os.path.isfile("site/foo.html"), "article not built")
     c = open("site/foo.html")
     self.assertIn("<title>", c.read(), "article content wrong")
     c.close()
Exemple #3
0
 def test_hard_language(self):
     """Test, that an article with language in URL is built"""
     art = open("_articles/foo.en.html", "w")
     art.write("Title: foo\n\n")
     art.close()
     build({
         "BUILD_TARGET": os.path.join(self.tmpdir, "site"),
         "NEGOTIATE_EXTENSIONS": True,
     })
     self.assertTrue(os.path.isfile("site/foo.en.html"),
                     "article not built")
     c = open("site/foo.en.html")
     self.assertIn('xml:lang="en"', c.read(), "article content wrong")
     c.close()
Exemple #4
0
 def test_categorized_article(self):
     """Test, that an article in a folder is built"""
     os.mkdir("_articles/bar")
     art = open("_articles/bar/foo.html", "w")
     art.write("Title: Foo\n\n<p>Test</p>")
     art.close()
     build({"BUILD_TARGET": os.path.join(self.tmpdir, "site")})
     self.assertTrue(os.path.isfile("site/bar/foo.html"),
                     "article not built")
     self.assertTrue(os.path.isfile("site/bar/index.html"),
                     "category index page not built")
     c = open("site/bar/foo.html")
     self.assertIn("Foo", c.read(), "article content wrong")
     c.close()
Exemple #5
0
 def test_archive(self):
     """Check, if an archive is built"""
     build({"BUILD_TARGET": os.path.join(self.tmpdir, "site")})
     self.assertTrue(
         os.path.isdir(os.path.join(self.tmpdir, "site/archive")),
         "archive directory not built")
     self.assertTrue(
         os.path.isfile(
             os.path.join(
                 self.tmpdir,
                 "site/archive/%s/index.html" % datetime.now().year)),
         "archive/year directory not built")
     self.assertTrue(
         os.path.isfile(
             os.path.join(
                 self.tmpdir, "site/archive/%s/%02d/index.html" %
                 (datetime.now().year, datetime.now().month))),
         "archive/year/month not built")
Exemple #6
0
 def test_empty_build(self):
     """Check, if building w/o articles works"""
     shutil.rmtree(os.path.join(self.tmpdir, "_articles"))
     os.mkdir(os.path.join(self.tmpdir, "_articles"))
     build({"BUILD_TARGET": os.path.join(self.tmpdir, "site")})
Exemple #7
0
 def test_moved_build(self):
     """Check, if building to a different directory works"""
     builddir = tempfile.mkdtemp()
     build({"BUILD_TARGET": builddir})
     self.assertTrue(os.path.isfile(os.path.join(builddir, "humans.txt")),
                     "humans.txt not added to non-default build")
Exemple #8
0
 def test_initial_build(self):
     """Check, if building directly after bootstrap works"""
     build({"BUILD_TARGET": os.path.join(self.tmpdir, "site")})