OLD | NEW |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 def test_no_version(rootdir, base_no_version): | 120 def test_no_version(rootdir, base_no_version): |
121 code, err, _ = run_script(str(rootdir.join('latest.txt')), '-o', | 121 code, err, _ = run_script(str(rootdir.join('latest.txt')), '-o', |
122 str(diff_dir), *base_no_version) | 122 str(diff_dir), *base_no_version) |
123 assert code == 1 | 123 assert code == 1 |
124 assert 'Unable to find Version in ' in err | 124 assert 'Unable to find Version in ' in err |
125 | 125 |
126 | 126 |
127 def test_write_and_overwrite(rootdir, archived_files, diff_dir): | 127 def test_write_and_overwrite(rootdir, archived_files, diff_dir): |
128 test_diff_with_outfile(rootdir, archived_files, diff_dir) | 128 test_diff_with_outfile(rootdir, archived_files, diff_dir) |
129 latest = re.sub(r'&act=ads_', '! ', BASE) | 129 latest = re.sub(r'&act=ads_', '! ', BASE) + '&adurl=\n' |
130 latest = latest + '&adurl=\n' | |
131 rootdir.join('latest.txt').write_text(latest, encoding='utf8') | 130 rootdir.join('latest.txt').write_text(latest, encoding='utf8') |
132 run_script(str(rootdir.join('latest.txt')), '-o', str(diff_dir), | 131 run_script(str(rootdir.join('latest.txt')), '-o', str(diff_dir), |
133 *archived_files) | 132 *archived_files) |
134 assert len(diff_dir.listdir()) == 2 | 133 assert len(diff_dir.listdir()) == 2 |
135 for file in diff_dir.visit(): | 134 for file in diff_dir.visit(): |
136 with io.open(str(file), encoding='utf-8') as dst: | 135 with io.open(str(file), encoding='utf-8') as dst: |
137 result = dst.read() | 136 result = dst.read() |
138 assert '- &act=ads_' in result | 137 assert '- &act=ads_' in result |
139 assert '+ &adurl=' in result | 138 assert '+ &adurl=' in result |
140 assert '- &ad.vid=$~xmlhttprequest' not in result | 139 assert '- &ad.vid=$~xmlhttprequest' not in result |
OLD | NEW |