aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_integration.py
diff options
context:
space:
mode:
authorLibravatarDererk <dererk@satellogic.com>2016-11-15 14:18:53 -0300
committerLibravatarDererk <dererk@satellogic.com>2016-11-15 14:18:53 -0300
commit1ad5102b7ddd181bb9c632b124d3ea4c7db28be6 (patch)
tree73dda18465d0f4b8eb52d4482282a387c9f67c95 /tests/test_integration.py
parentb67294f76809a681ff73f209ed691a3e3f00563d (diff)
parentffb671c61a24a9086343b54bad080e145ff33fc5 (diff)
Merge tag 'upstream/7.8.1'
Upstream version 7.8.1 # gpg: Firmado el mar 15 nov 2016 14:18:48 ART # gpg: usando RSA clave A6C7B88B9583046A11C5403E0B00FB6CEBE2D002 # gpg: Firma correcta de "Ulises Vitulli <dererk@debian.org>" [absoluta] # gpg: alias "Dererk <dererk@torproject.org>" [absoluta] # gpg: alias "Ulises Vitulli <uvitulli@fi.uba.ar>" [absoluta] # gpg: alias "Ulises Vitulli <dererk@satellogic.com>" [absoluta]
Diffstat (limited to 'tests/test_integration.py')
-rw-r--r--tests/test_integration.py85
1 files changed, 17 insertions, 68 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 4bfd1d2..87a3eba 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -203,8 +203,8 @@ class TranslatedBuildTest(EmptyBuildTest):
def test_translated_titles(self):
"""Check that translated title is picked up."""
- en_file = os.path.join(self.target_dir, "output", "stories", "1.html")
- pl_file = os.path.join(self.target_dir, "output", self.ol, "stories", "1.html")
+ en_file = os.path.join(self.target_dir, "output", "pages", "1.html")
+ pl_file = os.path.join(self.target_dir, "output", self.ol, "pages", "1.html")
# Files should be created
self.assertTrue(os.path.isfile(en_file))
self.assertTrue(os.path.isfile(pl_file))
@@ -223,8 +223,8 @@ class TranslationsPatternTest1(TranslatedBuildTest):
@classmethod
def patch_site(self):
"""Set the TRANSLATIONS_PATTERN to the old v6 default"""
- os.rename(os.path.join(self.target_dir, "stories", "1.%s.txt" % self.ol),
- os.path.join(self.target_dir, "stories", "1.txt.%s" % self.ol)
+ os.rename(os.path.join(self.target_dir, "pages", "1.%s.txt" % self.ol),
+ os.path.join(self.target_dir, "pages", "1.txt.%s" % self.ol)
)
conf_path = os.path.join(self.target_dir, "conf.py")
with io.open(conf_path, "r", encoding="utf-8") as inf:
@@ -241,7 +241,7 @@ class MissingDefaultLanguageTest(TranslatedBuildTest):
@classmethod
def fill_site(self):
super(MissingDefaultLanguageTest, self).fill_site()
- os.unlink(os.path.join(self.target_dir, "stories", "1.txt"))
+ os.unlink(os.path.join(self.target_dir, "pages", "1.txt"))
def test_translated_titles(self):
"""Do not test titles as we just removed the translation"""
@@ -255,8 +255,8 @@ class TranslationsPatternTest2(TranslatedBuildTest):
def patch_site(self):
"""Set the TRANSLATIONS_PATTERN to the old v6 default"""
conf_path = os.path.join(self.target_dir, "conf.py")
- os.rename(os.path.join(self.target_dir, "stories", "1.%s.txt" % self.ol),
- os.path.join(self.target_dir, "stories", "1.txt.%s" % self.ol)
+ os.rename(os.path.join(self.target_dir, "pages", "1.%s.txt" % self.ol),
+ os.path.join(self.target_dir, "pages", "1.txt.%s" % self.ol)
)
with io.open(conf_path, "r", encoding="utf-8") as inf:
data = inf.read()
@@ -307,17 +307,11 @@ class TestCheck(DemoBuildTest):
def test_check_links(self):
with cd(self.target_dir):
- try:
- __main__.main(['check', '-l'])
- except SystemExit as e:
- self.assertEqual(e.code, 0)
+ self.assertIsNone(__main__.main(['check', '-l']))
def test_check_files(self):
with cd(self.target_dir):
- try:
- __main__.main(['check', '-f'])
- except SystemExit as e:
- self.assertEqual(e.code, 0)
+ self.assertIsNone(__main__.main(['check', '-f']))
class TestCheckAbsoluteSubFolder(TestCheck):
@@ -390,7 +384,7 @@ class TestCheckFailure(DemoBuildTest):
class RelativeLinkTest2(DemoBuildTest):
- """Check that dropping stories to the root doesn't break links."""
+ """Check that dropping pages to the root doesn't break links."""
@classmethod
def patch_site(self):
@@ -398,10 +392,10 @@ class RelativeLinkTest2(DemoBuildTest):
conf_path = os.path.join(self.target_dir, "conf.py")
with io.open(conf_path, "r", encoding="utf-8") as inf:
data = inf.read()
- data = data.replace('("stories/*.txt", "stories", "story.tmpl"),',
- '("stories/*.txt", "", "story.tmpl"),')
- data = data.replace('("stories/*.rst", "stories", "story.tmpl"),',
- '("stories/*.rst", "", "story.tmpl"),')
+ data = data.replace('("pages/*.txt", "pages", "story.tmpl"),',
+ '("pages/*.txt", "", "story.tmpl"),')
+ data = data.replace('("pages/*.rst", "pages", "story.tmpl"),',
+ '("pages/*.rst", "", "story.tmpl"),')
data = data.replace('# INDEX_PATH = ""',
'INDEX_PATH = "blog"')
with io.open(conf_path, "w+", encoding="utf8") as outf:
@@ -409,7 +403,7 @@ class RelativeLinkTest2(DemoBuildTest):
outf.flush()
def test_relative_links(self):
- """Check that the links in a story are correct"""
+ """Check that the links in a page are correct"""
test_path = os.path.join(self.target_dir, "output", "about-nikola.html")
flag = False
with open(test_path, "rb") as inf:
@@ -504,53 +498,6 @@ class SubdirRunningTest(DemoBuildTest):
self.assertEquals(result, 0)
-class InvariantBuildTest(EmptyBuildTest):
- """Test that a default build of --demo works."""
-
- @classmethod
- def build(self):
- """Build the site."""
- try:
- self.oldlocale = locale.getlocale()
- locale.setlocale(locale.LC_ALL, ("en_US", "utf8"))
- except:
- pytest.skip('no en_US locale!')
- else:
- with cd(self.target_dir):
- __main__.main(["build", "--invariant"])
- finally:
- try:
- locale.setlocale(locale.LC_ALL, self.oldlocale)
- except:
- pass
-
- @classmethod
- def fill_site(self):
- """Fill the site with demo content."""
- self.init_command.copy_sample_site(self.target_dir)
- self.init_command.create_configuration(self.target_dir)
- src1 = os.path.join(os.path.dirname(__file__), 'data', '1-nolinks.rst')
- dst1 = os.path.join(self.target_dir, 'posts', '1.rst')
- shutil.copy(src1, dst1)
- os.system('rm "{0}/stories/creating-a-theme.rst" "{0}/stories/extending.txt" "{0}/stories/internals.txt" "{0}/stories/manual.rst" "{0}/stories/social_buttons.txt" "{0}/stories/theming.rst" "{0}/stories/upgrading-to-v6.txt"'.format(self.target_dir))
-
- def test_invariance(self):
- """Compare the output to the canonical output."""
- if sys.version_info[0:2] != (2, 7):
- pytest.skip('only python 2.7 is supported right now')
- good_path = os.path.join(os.path.dirname(__file__), 'data', 'baseline{0[0]}.{0[1]}'.format(sys.version_info))
- if not os.path.exists(good_path):
- pytest.skip('no baseline found')
- with cd(self.target_dir):
- try:
- diff = subprocess.check_output(['diff', '-ubwr', good_path, 'output'])
- self.assertEqual(diff.strip(), '')
- except subprocess.CalledProcessError as exc:
- print('Unexplained diff for the invariance test. (-canonical +built)')
- print(exc.output.decode('utf-8'))
- self.assertEqual(exc.returncode, 0, 'Unexplained diff for the invariance test.')
-
-
class RedirectionsTest1(TestCheck):
"""Check REDIRECTIONS"""
@@ -568,6 +515,7 @@ class RedirectionsTest1(TestCheck):
with io.open(target_path, "w+", encoding="utf8") as outf:
outf.write("foo")
+
class RedirectionsTest2(TestCheck):
"""Check external REDIRECTIONS"""
@@ -578,6 +526,7 @@ class RedirectionsTest2(TestCheck):
with io.open(conf_path, "a", encoding="utf8") as outf:
outf.write("""\n\nREDIRECTIONS = [ ("foo.html", "http://www.example.com/"), ]\n\n""")
+
class RedirectionsTest3(TestCheck):
"""Check relative REDIRECTIONS"""