| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 test_input = eval(test_input) | 114 test_input = eval(test_input) |
| 115 args = list(map(eval, args)) | 115 args = list(map(eval, args)) |
| 116 _, _, stdout = run_script(*args, cwd=str(rootdir), test_in=test_input) | 116 _, _, stdout = run_script(*args, cwd=str(rootdir), test_in=test_input) |
| 117 | 117 |
| 118 if len(args) > 1: | 118 if len(args) > 1: |
| 119 output = dstfile.read() | 119 output = dstfile.read() |
| 120 else: | 120 else: |
| 121 output = stdout | 121 output = stdout |
| 122 | 122 |
| 123 assert 'Ok' in output | 123 assert 'Ok' in output |
| 124 assert '! Checksum:' in output | |
| 125 | 124 |
| 126 | 125 |
| 127 def test_render_unicode(rootdir, dstfile): | 126 def test_render_unicode(rootdir, dstfile): |
| 128 code, err, _ = run_script(str(rootdir.join('unicode.txt')), str(dstfile)) | 127 code, err, _ = run_script(str(rootdir.join('unicode.txt')), str(dstfile)) |
| 129 assert '\u1234' in dstfile.read(mode='rb').decode('utf-8') | 128 assert '\u1234' in dstfile.read(mode='rb').decode('utf-8') |
| 130 | 129 |
| 131 | 130 |
| 132 def test_render_with_includes(rootdir, dstfile): | 131 def test_render_with_includes(rootdir, dstfile): |
| 133 run_script(str(rootdir.join('includer.txt')), str(dstfile), | 132 run_script(str(rootdir.join('includer.txt')), str(dstfile), |
| 134 '-i', 'inc=' + str(rootdir.join('inc'))) | 133 '-i', 'inc=' + str(rootdir.join('inc'))) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 202 |
| 204 @pytest.mark.slowtest | 203 @pytest.mark.slowtest |
| 205 def test_failed_web_include(rootdir, dstfile, webserver_port): | 204 def test_failed_web_include(rootdir, dstfile, webserver_port): |
| 206 url = 'http://localhost:{}/missing.txt'.format(webserver_port) | 205 url = 'http://localhost:{}/missing.txt'.format(webserver_port) |
| 207 webinc = rootdir.join('webinc.txt') | 206 webinc = rootdir.join('webinc.txt') |
| 208 webinc.write('[Adblock]\n%include {}%'.format(url)) | 207 webinc.write('[Adblock]\n%include {}%'.format(url)) |
| 209 code, err, _ = run_script(str(webinc), str(dstfile)) | 208 code, err, _ = run_script(str(webinc), str(dstfile)) |
| 210 assert code == 1 | 209 assert code == 1 |
| 211 assert err.startswith( | 210 assert err.startswith( |
| 212 "HTTP 404 Not found: '{0}' when including '{0}'".format(url)) | 211 "HTTP 404 Not found: '{0}' when including '{0}'".format(url)) |
| OLD | NEW |