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: Add tests Created April 12, 2019, 2:37 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
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,29 @@
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 to "missing" (from "brokenlink") cannot be resolved',
+ 'Link to "missing" (from "brokenlink-html") cannot be resolved',
+ 'Link to "missing" (from "brokenlink-tmpl") cannot be resolved',
+ ]
+ for message in expected_messages:
+ assert message in messages
rhowell 2019/04/12 20:17:12 NIT: This test might be a bit stricter if we used
Vasily Kuznetsov 2019/04/15 16:48:45 Yes, I thought about it too. In the end I decided
rhowell 2019/04/16 01:46:58 Makes sense.
+
+
@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}

Powered by Google App Engine
This is Rietveld