OLD | NEW |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 | 46 |
47 @pytest.fixture(scope='session') | 47 @pytest.fixture(scope='session') |
48 def ap_site(temp_site, tmpdir_factory): | 48 def ap_site(temp_site, tmpdir_factory): |
49 """A website source that has another website in additional-paths.""" | 49 """A website source that has another website in additional-paths.""" |
50 base_root = py.path.local(temp_site) | 50 base_root = py.path.local(temp_site) |
51 base_pages = base_root.join('pages') | 51 base_pages = base_root.join('pages') |
52 | 52 |
53 ap_root = tmpdir_factory.mktemp('ap_site') | 53 ap_root = tmpdir_factory.mktemp('ap_site') |
54 ap_root.join('settings.ini').write( | 54 ap_root.join('settings.ini').write( |
55 base_root.join('settings.ini').read() + | 55 base_root.join('settings.ini').read() |
56 PATHS_FRAGMENT_TEMPLATE.format(base_root), | 56 + PATHS_FRAGMENT_TEMPLATE.format(base_root), |
57 ) | 57 ) |
58 | 58 |
59 pages = ap_root.mkdir('pages') | 59 pages = ap_root.mkdir('pages') |
60 for file_name in ['filter.tmpl', 'global.md', 'translate.tmpl']: | 60 for file_name in ['filter.tmpl', 'global.md', 'translate.tmpl']: |
61 pages.join(file_name).write('MAIN_SITE') | 61 pages.join(file_name).write('MAIN_SITE') |
62 pages.join('map.tmpl').write(base_pages.join('sitemap.tmpl').read()) | 62 pages.join('map.tmpl').write(base_pages.join('sitemap.tmpl').read()) |
63 return ap_root | 63 return ap_root |
64 | 64 |
65 | 65 |
66 @pytest.fixture(scope='session') | 66 @pytest.fixture(scope='session') |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 three.join('three').write('') | 109 three.join('three').write('') |
110 three.join('settings.ini').write('') | 110 three.join('settings.ini').write('') |
111 | 111 |
112 four.join('four').write('') | 112 four.join('four').write('') |
113 four.join('settings.ini').write('[paths]') | 113 four.join('settings.ini').write('[paths]') |
114 | 114 |
115 source = create_source(one.strpath) | 115 source = create_source(one.strpath) |
116 | 116 |
117 for name in ['one', 'two', 'three', 'four']: | 117 for name in ['one', 'two', 'three', 'four']: |
118 assert source.has_file(name) | 118 assert source.has_file(name) |
OLD | NEW |