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

Unified Diff: tests/test_page_outputs.py

Issue 29400555: Issue 4992 - Adds optional revision arg to generate_static_pages (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: removes duplication in fixtures and addresses arg message changes Created April 3, 2017, 2:40 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/conftest.py ('k') | tests/test_site/templates/default.tmpl » ('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
@@ -20,20 +20,29 @@
def get_expected_outputs():
expected_out_path = os.path.join(ROOTPATH, 'tests', 'expected_output')
return get_dir_contents(expected_out_path).items()
expected_outputs = get_expected_outputs()
+@pytest.fixture(scope='session', params=['master', None])
+def revision(request):
+ return request.param
+
+
@pytest.fixture(scope='session')
-def static_output(request, temp_site):
+def static_output(revision, request, temp_site):
static_out_path = os.path.join(temp_site, 'static_out')
- sys.argv = ['filler', temp_site, static_out_path]
+ if revision is None:
Vasily Kuznetsov 2017/04/03 15:15:52 We don't really need to repeat the standard args t
Jon Sonesen 2017/04/04 07:01:23 Done.
+ sys.argv = ['filler', temp_site, static_out_path]
+ else:
+ sys.argv = ['filler', temp_site, static_out_path, '--rev', 'master']
Vasily Kuznetsov 2017/04/03 15:15:52 The last item of the list should be `revision` but
Jon Sonesen 2017/04/04 07:01:23 Done.
+
runpy.run_module('cms.bin.generate_static_pages', run_name='__main__')
return static_out_path
@pytest.yield_fixture()
def dynamic_server(temp_site):
args = ['python', 'runserver.py', temp_site]
# Werkzeug is a dependency of flask which we are using for the mock api
@@ -55,8 +64,15 @@
def test_static(output_pages, filename, expected_output):
assert output_pages[filename] == expected_output
@pytest.mark.parametrize('filename,expected_output', expected_outputs)
def test_dynamic(dynamic_server, filename, expected_output):
response = urllib2.urlopen(dynamic_server + filename)
assert response.read() == expected_output
+
+
+def test_revision_arg(revision, output_pages):
+ if revision is None:
+ assert 'bar' in output_pages
+ else:
+ assert 'bar' not in output_pages
« no previous file with comments | « tests/conftest.py ('k') | tests/test_site/templates/default.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld