From 7415d370e6a9c6f9b96da927685ffe9a6bc6eada Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Wed, 25 Sep 2013 16:13:28 +0200 Subject: [PATCH] Added tests. --- pelican/tests/test_contents.py | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 936903c1..2e44253a 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -204,6 +204,66 @@ class TestPage(unittest.TestCase): ('A simple test, with a ' 'link')) + def test_intrasite_link(self): + article = type(b'_DummyArticle', (object,), {'url': 'article.html'}) + + args = self.page_kwargs.copy() + args['settings'] = get_settings() + args['source_path'] = 'content' + args['context']['filenames'] = {'article.rst': article} + + # Classic intrasite link via filename + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + + # fragment + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + + # query + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + + # combination + args['content'] = ( + 'A simple test, with a ' + 'link' + ) + content = Page(**args).get_content('http://notmyidea.org') + self.assertEquals( + content, + 'A simple test, with a ' + 'link' + ) + class TestArticle(TestPage): def test_template(self):