mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add test checking url replcmnt of unkn. file
There was no test case checking the behaviour of what happens when
trying to {filename} an unknown file.
Also changed the braces to `'` chars that we use elseware.
This commit is contained in:
parent
dcb6882fbc
commit
22208a9471
2 changed files with 17 additions and 1 deletions
|
|
@ -246,7 +246,7 @@ class Content(object):
|
|||
origin = origin.replace('\\', '/') # for Windows paths.
|
||||
else:
|
||||
logger.warning(
|
||||
"Unable to find `%s`, skipping url replacement.",
|
||||
"Unable to find '%s', skipping url replacement.",
|
||||
value.geturl(), extra={
|
||||
'limit_msg': ("Other resources were not found "
|
||||
"and their urls not replaced")})
|
||||
|
|
|
|||
|
|
@ -731,3 +731,19 @@ class TestStatic(LoggedTestCase):
|
|||
msg="Replacement Indicator 'unknown' not recognized, "
|
||||
"skipping replacement",
|
||||
level=logging.WARNING)
|
||||
|
||||
def test_link_to_unknown_file(self):
|
||||
"{filename} link to unknown file should trigger warning."
|
||||
|
||||
html = '<a href="{filename}foo">link</a>'
|
||||
page = Page(content=html,
|
||||
metadata={'title': 'fakepage'}, settings=self.settings,
|
||||
source_path=os.path.join('dir', 'otherdir', 'fakepage.md'),
|
||||
context=self.context)
|
||||
content = page.get_content('')
|
||||
|
||||
self.assertEqual(content, html)
|
||||
self.assertLogCountEqual(
|
||||
count=1,
|
||||
msg="Unable to find 'foo', skipping url replacement.",
|
||||
level=logging.WARNING)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue