mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Added tests.
This commit is contained in:
parent
6fb0335269
commit
7415d370e6
1 changed files with 60 additions and 0 deletions
|
|
@ -204,6 +204,66 @@ class TestPage(unittest.TestCase):
|
||||||
('A simple test, with a '
|
('A simple test, with a '
|
||||||
'<a href="category/category.html">link</a>'))
|
'<a href="category/category.html">link</a>'))
|
||||||
|
|
||||||
|
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 '
|
||||||
|
'<a href="|filename|article.rst">link</a>'
|
||||||
|
)
|
||||||
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
|
self.assertEquals(
|
||||||
|
content,
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="http://notmyidea.org/article.html">link</a>'
|
||||||
|
)
|
||||||
|
|
||||||
|
# fragment
|
||||||
|
args['content'] = (
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="|filename|article.rst#section-2">link</a>'
|
||||||
|
)
|
||||||
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
|
self.assertEquals(
|
||||||
|
content,
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="http://notmyidea.org/article.html#section-2">link</a>'
|
||||||
|
)
|
||||||
|
|
||||||
|
# query
|
||||||
|
args['content'] = (
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="|filename|article.rst'
|
||||||
|
'?utm_whatever=234&highlight=word">link</a>'
|
||||||
|
)
|
||||||
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
|
self.assertEquals(
|
||||||
|
content,
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="http://notmyidea.org/article.html'
|
||||||
|
'?utm_whatever=234&highlight=word">link</a>'
|
||||||
|
)
|
||||||
|
|
||||||
|
# combination
|
||||||
|
args['content'] = (
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="|filename|article.rst'
|
||||||
|
'?utm_whatever=234&highlight=word#section-2">link</a>'
|
||||||
|
)
|
||||||
|
content = Page(**args).get_content('http://notmyidea.org')
|
||||||
|
self.assertEquals(
|
||||||
|
content,
|
||||||
|
'A simple test, with a '
|
||||||
|
'<a href="http://notmyidea.org/article.html'
|
||||||
|
'?utm_whatever=234&highlight=word#section-2">link</a>'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestArticle(TestPage):
|
class TestArticle(TestPage):
|
||||||
def test_template(self):
|
def test_template(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue