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 |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 import pytest | 16 import pytest |
17 | 17 |
18 from abp.filters import FSSource, NotFound | 18 from abp.filters.sources import FSSource, NotFound |
19 | 19 |
20 | 20 |
21 @pytest.fixture | 21 @pytest.fixture |
22 def fssource_dir(tmpdir): | 22 def fssource_dir(tmpdir): |
23 tmpdir.mkdir('root') | 23 tmpdir.mkdir('root') |
24 not_in_source = tmpdir.join('not-in-source.txt') | 24 not_in_source = tmpdir.join('not-in-source.txt') |
25 not_in_source.write('! secret') | 25 not_in_source.write('! secret') |
26 root = tmpdir.join('root') | 26 root = tmpdir.join('root') |
27 root.mkdir('foo') | 27 root.mkdir('foo') |
28 foobar = root.join('foo', 'bar.txt') | 28 foobar = root.join('foo', 'bar.txt') |
(...skipping 11 matching lines...) Expand all Loading... |
40 | 40 |
41 | 41 |
42 def test_escape_source(fssource): | 42 def test_escape_source(fssource): |
43 with pytest.raises(ValueError): | 43 with pytest.raises(ValueError): |
44 list(fssource.get('../not-in-source.txt')) | 44 list(fssource.get('../not-in-source.txt')) |
45 | 45 |
46 | 46 |
47 def test_read_missing_file(fssource): | 47 def test_read_missing_file(fssource): |
48 with pytest.raises(NotFound): | 48 with pytest.raises(NotFound): |
49 list(fssource.get('foo/baz.txt')) | 49 list(fssource.get('foo/baz.txt')) |
LEFT | RIGHT |