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

Delta Between Two Patch Sets: tests/test_page_outputs.py

Issue 29659605: Issue 6231 - Add tests for translation string substitution (Closed)
Left Patch Set: Add tests for different types of pages; also for includes and templates Created Jan. 12, 2018, 7:53 p.m.
Right Patch Set: Add tests for partial translation and for get_string Created Jan. 19, 2018, 3:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « tests/expected_output/en/translate-tmpl ('k') | tests/test_site/includes/included-translations.html » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 import os 1 import os
2 import sys 2 import sys
3 import runpy 3 import runpy
4 import pytest 4 import pytest
5 import urllib2 5 import urllib2
6 6
7 from .conftest import ROOTPATH 7 from .conftest import ROOTPATH
8 from .utils import get_dir_contents, run_test_server 8 from .utils import get_dir_contents, run_test_server
9 9
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 yield ts 48 yield ts
49 49
50 50
51 @pytest.fixture(scope='session') 51 @pytest.fixture(scope='session')
52 def output_pages(static_output): 52 def output_pages(static_output):
53 return get_dir_contents(static_output) 53 return get_dir_contents(static_output)
54 54
55 55
56 @pytest.mark.parametrize('filename,expected_output', static_expected_outputs) 56 @pytest.mark.parametrize('filename,expected_output', static_expected_outputs)
57 def test_static(output_pages, filename, expected_output): 57 def test_static(output_pages, filename, expected_output):
58 assert output_pages[filename] == expected_output 58 if expected_output.startswith('## MISSING'):
Vasily Kuznetsov 2018/01/19 15:34:29 This allows us to check that a certain file _is_no
Jon Sonesen 2018/01/19 19:25:35 Acknowledged.
59 assert filename not in output_pages
60 else:
61 assert expected_output == output_pages[filename]
59 62
60 63
61 @pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs) 64 @pytest.mark.parametrize('filename,expected_output', dynamic_expected_outputs)
62 def test_dynamic(dynamic_server, filename, expected_output): 65 def test_dynamic(dynamic_server, filename, expected_output):
63 response = urllib2.urlopen(dynamic_server + filename) 66 response = urllib2.urlopen(dynamic_server + filename)
64 assert response.read().strip() == expected_output 67 assert expected_output == response.read().strip()
Vasily Kuznetsov 2018/01/19 15:34:29 I changed the order of arguments in a comparison t
Jon Sonesen 2018/01/19 19:25:35 Acknowledged.
65 68
66 69
67 def test_revision_arg(revision, output_pages): 70 def test_revision_arg(revision, output_pages):
68 if revision is None: 71 if revision is None:
69 assert 'en/bar' in output_pages 72 assert 'en/bar' in output_pages
70 else: 73 else:
71 assert 'en/bar' not in output_pages 74 assert 'en/bar' not in output_pages
LEFTRIGHT

Powered by Google App Engine
This is Rietveld