LEFT | RIGHT |
(no file at all) | |
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 11 matching lines...) Expand all Loading... |
22 from __future__ import unicode_literals | 22 from __future__ import unicode_literals |
23 | 23 |
24 import os | 24 import os |
25 import pytest | 25 import pytest |
26 import subprocess | 26 import subprocess |
27 import threading | 27 import threading |
28 | 28 |
29 try: | 29 try: |
30 import SimpleHTTPServer | 30 import SimpleHTTPServer |
31 import SocketServer | 31 import SocketServer |
32 except: # The modules were renamed/moved in Python 3. | 32 except ImportError: # The modules were renamed/moved in Python 3. |
33 import http.server as SimpleHTTPServer | 33 import http.server as SimpleHTTPServer |
34 import socketserver as SocketServer | 34 import socketserver as SocketServer |
35 | 35 |
36 | 36 |
37 @pytest.fixture | 37 @pytest.fixture |
38 def rootdir(tmpdir): | 38 def rootdir(tmpdir): |
39 """Directory with prepared list fragments.""" | 39 """Directory with prepared list fragments.""" |
40 rootdir = tmpdir.join('root') | 40 rootdir = tmpdir.join('root') |
41 rootdir.mkdir() | 41 rootdir.mkdir() |
42 # Simple file with just `Ok` and a non-ascii unicode character in it. | 42 # Simple file with just `Ok` and a non-ascii unicode character in it. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 @pytest.mark.slowtest | 184 @pytest.mark.slowtest |
185 def test_failed_web_include(rootdir, dstfile, webserver_port): | 185 def test_failed_web_include(rootdir, dstfile, webserver_port): |
186 url = 'http://localhost:{}/missing.txt'.format(webserver_port) | 186 url = 'http://localhost:{}/missing.txt'.format(webserver_port) |
187 webinc = rootdir.join('webinc.txt') | 187 webinc = rootdir.join('webinc.txt') |
188 webinc.write('[Adblock]\n%include {}%'.format(url)) | 188 webinc.write('[Adblock]\n%include {}%'.format(url)) |
189 code, err = run_script(str(webinc), str(dstfile)) | 189 code, err = run_script(str(webinc), str(dstfile)) |
190 assert code == 1 | 190 assert code == 1 |
191 assert err.startswith( | 191 assert err.startswith( |
192 "HTTP 404 Not found: '{0}' when including '{0}'".format(url)) | 192 "HTTP 404 Not found: '{0}' when including '{0}'".format(url)) |
LEFT | RIGHT |