add support for relative cross-site links

This commit is contained in:
Bruno Binet 2012-12-01 18:22:43 +01:00
commit a0504aeabe
7 changed files with 26 additions and 19 deletions

View file

@ -19,6 +19,9 @@ class TestPage(unittest.TestCase):
super(TestPage, self).setUp()
self.page_kwargs = {
'content': TEST_CONTENT,
'context': {
'localsiteurl': '',
},
'metadata': {
'summary': TEST_SUMMARY,
'title': 'foo bar',
@ -32,7 +35,8 @@ class TestPage(unittest.TestCase):
"""
metadata = {'foo': 'bar', 'foobar': 'baz', 'title': 'foobar', }
page = Page(TEST_CONTENT, metadata=metadata)
page = Page(TEST_CONTENT, metadata=metadata,
context={'localsiteurl': ''})
for key, value in metadata.items():
self.assertTrue(hasattr(page, key))
self.assertEqual(value, getattr(page, key))

View file

@ -96,6 +96,7 @@ class TestArticlesGenerator(unittest.TestCase):
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 01, 01)
settings['USE_FOLDER_AS_CATEGORY'] = False
settings['filenames'] = {}
generator = ArticlesGenerator(settings.copy(), settings,
CUR_DIR, _DEFAULT_CONFIG['THEME'], None,
_DEFAULT_CONFIG['MARKUP'])

View file

@ -81,7 +81,7 @@ class TestPelican(unittest.TestCase):
self.assertEqual(self.logcount_handler.count_logs(
msg="Unable to find.*skipping url replacement",
level=logging.WARNING,
), 4, msg="bad number of occurences found for this log")
), 10, msg="bad number of occurences found for this log")
def test_custom_generation_works(self):
# the same thing with a specified set of settings should work