Left: | ||
Right: |
OLD | NEW |
---|---|
1 import os | 1 import os |
2 import sys | 2 import sys |
3 import time | 3 import time |
4 import runpy | 4 import runpy |
5 import signal | 5 import signal |
6 import pytest | 6 import pytest |
7 import urllib2 | 7 import urllib2 |
8 import subprocess | 8 import subprocess |
9 from conftest import ROOTPATH | 9 from conftest import ROOTPATH |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 def get_expected_outputs(): | 21 def get_expected_outputs(): |
22 expected_out_path = os.path.join(ROOTPATH, 'tests', 'expected_output') | 22 expected_out_path = os.path.join(ROOTPATH, 'tests', 'expected_output') |
23 return get_dir_contents(expected_out_path).items() | 23 return get_dir_contents(expected_out_path).items() |
24 | 24 |
25 expected_outputs = get_expected_outputs() | 25 expected_outputs = get_expected_outputs() |
26 | 26 |
27 | 27 |
28 @pytest.fixture(scope='session') | 28 @pytest.fixture(scope='session') |
29 def static_output(request, temp_site): | 29 def static_output(request, temp_site): |
30 static_out_path = os.path.join(temp_site, 'static_out') | 30 static_out_path = os.path.join(temp_site, 'static_out') |
31 sys.argv = ['filler', temp_site, static_out_path] | 31 sys.argv = ['filler', temp_site, static_out_path, '--rev', 'master'] |
32 runpy.run_module('cms.bin.generate_static_pages', run_name='__main__') | 32 runpy.run_module('cms.bin.generate_static_pages', run_name='__main__') |
33 return static_out_path | 33 return static_out_path |
34 | 34 |
35 | 35 |
36 @pytest.yield_fixture() | 36 @pytest.yield_fixture() |
37 def dynamic_server(temp_site): | 37 def dynamic_server(temp_site): |
38 args = ['python', 'runserver.py', temp_site] | 38 args = ['python', 'runserver.py', temp_site] |
39 # Werkzeug is a dependency of flask which we are using for the mock api | 39 # Werkzeug is a dependency of flask which we are using for the mock api |
40 # however there is an issue with Werkzeug that prevents it from properly | 40 # however there is an issue with Werkzeug that prevents it from properly |
41 # handling the SIGTERM sent by p.kill() or terminate() | 41 # handling the SIGTERM sent by p.kill() or terminate() |
(...skipping 11 matching lines...) Expand all Loading... | |
53 | 53 |
54 @pytest.mark.parametrize('filename,expected_output', expected_outputs) | 54 @pytest.mark.parametrize('filename,expected_output', expected_outputs) |
55 def test_static(output_pages, filename, expected_output): | 55 def test_static(output_pages, filename, expected_output): |
56 assert output_pages[filename] == expected_output | 56 assert output_pages[filename] == expected_output |
57 | 57 |
58 | 58 |
59 @pytest.mark.parametrize('filename,expected_output', expected_outputs) | 59 @pytest.mark.parametrize('filename,expected_output', expected_outputs) |
60 def test_dynamic(dynamic_server, filename, expected_output): | 60 def test_dynamic(dynamic_server, filename, expected_output): |
61 response = urllib2.urlopen(dynamic_server + filename) | 61 response = urllib2.urlopen(dynamic_server + filename) |
62 assert response.read() == expected_output | 62 assert response.read() == expected_output |
63 | |
64 | |
65 def test_revision_arg(output_pages): | |
Jon Sonesen
2017/04/01 12:40:56
The bookmark consists of an additional page 'bar'
Vasily Kuznetsov
2017/04/03 09:55:08
We should also run generation with no '--rev' argu
Jon Sonesen
2017/04/03 10:11:00
Acknowledged.
| |
66 assert 'bar' not in output_pages | |
OLD | NEW |