| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 web_mock.return_value = response_mock('utf-8', b'\xc3\xbc') | 62 web_mock.return_value = response_mock('utf-8', b'\xc3\xbc') |
| 63 assert list(http_source.get('//foo/bar.txt')) == ['\xfc'] | 63 assert list(http_source.get('//foo/bar.txt')) == ['\xfc'] |
| 64 web_mock.return_value = response_mock(None, b'\xc3\xbc') | 64 web_mock.return_value = response_mock(None, b'\xc3\xbc') |
| 65 assert list(http_source.get('//foo/bar.txt')) == ['\xfc'] | 65 assert list(http_source.get('//foo/bar.txt')) == ['\xfc'] |
| 66 | 66 |
| 67 | 67 |
| 68 def test_404(web_mock, http_source): | 68 def test_404(web_mock, http_source): |
| 69 web_mock.side_effect = HTTPError('', 404, 'Not found', [], StringIO(b'')) | 69 web_mock.side_effect = HTTPError('', 404, 'Not found', [], StringIO(b'')) |
| 70 with pytest.raises(NotFound): | 70 with pytest.raises(NotFound): |
| 71 list(http_source.get('//foo/bar.txt')) | 71 list(http_source.get('//foo/bar.txt')) |
| 72 |
| 73 |
| 74 def test_500(web_mock, http_source): |
| 75 web_mock.side_effect = HTTPError('', 500, 'Internal Server Error', [], |
| 76 StringIO(b'')) |
| 77 with pytest.raises(HTTPError): |
| 78 list(http_source.get('//foo/bar.txt')) |
| OLD | NEW |