Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_page_outputs.py

Issue 30044555: Issue 7461 - Include source page into warning text for unresolved links (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: Improve readability of the error message Created April 15, 2019, 4:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/expected_output/common/en/sitemap ('k') | tests/test_site/pages/brokenlink.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_page_outputs.py
===================================================================
--- a/tests/test_page_outputs.py
+++ b/tests/test_page_outputs.py
@@ -1,8 +1,9 @@
+import logging
import os
import sys
import runpy
import mock
import pytest
from .conftest import ROOTPATH
@@ -60,16 +61,30 @@
assert expected_output == output_pages_relative[filename]
def test_cache(output_pages):
source = FileSource(os.path.join('test_site'))
assert source.get_cache_dir() == os.path.join('test_site', 'cache')
+def test_broken_link_warnings(temp_site, tmpdir_factory, caplog):
+ caplog.set_level(logging.WARNING)
+ generate_static_pages(temp_site, tmpdir_factory)
+ messages = {t[2] for t in caplog.record_tuples}
+ expected_messages = [
+ 'Link from "brokenlink" to "missing" cannot be resolved',
+ 'Link from "brokenlink-html" to "missing" cannot be resolved',
+ 'Link from "brokenlink-tmpl" to "missing" cannot be resolved',
+ ]
+ for message in expected_messages:
+ assert message in messages
+ raise messages
+
+
@pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs)
def test_dynamic_server_handler(filename, expected_output, temp_site):
def cleanup(page):
return page.replace(os.linesep, '').strip()
handler = DynamicServerHandler('localhost', 5000, str(temp_site))
environ = {'PATH_INFO': filename}
« no previous file with comments | « tests/expected_output/common/en/sitemap ('k') | tests/test_site/pages/brokenlink.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld