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

Side by Side Diff: tests/test_renderer.py

Issue 29851654: Issue 6850 - Remove generation of checksums (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Add test for checksum removal, fix README references Created Aug. 10, 2018, 10:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/test_render_script.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return self.files[filename].split('\n') 49 return self.files[filename].split('\n')
50 50
51 51
52 def render_str(*args, **kw): 52 def render_str(*args, **kw):
53 return '\n'.join(l.to_string() for l in render_filterlist(*args, **kw)) 53 return '\n'.join(l.to_string() for l in render_filterlist(*args, **kw))
54 54
55 55
56 def test_simple_render(head): 56 def test_simple_render(head):
57 src = MockSource(fl='[Adblock]\n! Comment.') 57 src = MockSource(fl='[Adblock]\n! Comment.')
58 got = render_str('fl', {}, src) 58 got = render_str('fl', {}, src)
59 assert got == head + '! Comment.\n! Checksum: bmdRu7Y9gm9DAV6vOoAv4Q' 59 assert got == head + '! Comment.'
60 60
61 61
62 def test_include(head): 62 def test_include(head):
63 src = MockSource(fl='[Adblock]\n%include src:inc%', inc='Included') 63 src = MockSource(fl='[Adblock]\n%include src:inc%', inc='Included')
64 got = render_str('src:fl', {'src': src}) 64 got = render_str('src:fl', {'src': src})
65 assert got.startswith(head + '! *** src:inc ***\nIncluded') 65 assert got.startswith(head + '! *** src:inc ***\nIncluded')
66 66
67 67
68 def test_include2(head): 68 def test_include2(head):
69 src1 = MockSource(fl='[Adblock]\n%include inc1%', 69 src1 = MockSource(fl='[Adblock]\n%include inc1%',
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 src2 = MockSource(is_inheritable=False, 111 src2 = MockSource(is_inheritable=False,
112 inc1='%include inc2%', inc2='Included') 112 inc1='%include inc2%', inc2='Included')
113 with pytest.raises(IncludeError): 113 with pytest.raises(IncludeError):
114 render_str('src1:fl', {'src1': src1, 'src2': src2}) 114 render_str('src1:fl', {'src1': src1, 'src2': src2})
115 115
116 116
117 def test_missing_header(): 117 def test_missing_header():
118 src = MockSource(fl='! No header') 118 src = MockSource(fl='! No header')
119 with pytest.raises(MissingHeader): 119 with pytest.raises(MissingHeader):
120 render_str('fl', {}, src) 120 render_str('fl', {}, src)
121
122
123 def test_remove_checksum(head):
124 src = MockSource(fl='[Adblock]\n! Comment\n! Checksum: foo')
125 got = render_str('fl', {}, src)
126 assert got == head + '! Comment'
OLDNEW
« no previous file with comments | « tests/test_render_script.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld