| LEFT | RIGHT |
| 1 from __future__ import unicode_literals | 1 from __future__ import unicode_literals |
| 2 | 2 |
| 3 import os | 3 import os |
| 4 import shutil | 4 import shutil |
| 5 import json | 5 import json |
| 6 | 6 |
| 7 import pytest | 7 import pytest |
| 8 from cms.sources import FileSource | 8 from cms.sources import FileSource |
| 9 from wsgi_intercept import add_wsgi_intercept | 9 from wsgi_intercept import add_wsgi_intercept |
| 10 from wsgi_intercept import remove_wsgi_intercept | 10 from wsgi_intercept import remove_wsgi_intercept |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) | 83 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) |
| 84 | 84 |
| 85 with FileSource(str(site_dir)) as fs: | 85 with FileSource(str(site_dir)) as fs: |
| 86 fs.write_to_config('XTM', 'url', 'www.bar.com') | 86 fs.write_to_config('XTM', 'url', 'www.bar.com') |
| 87 | 87 |
| 88 return site_dir | 88 return site_dir |
| 89 | 89 |
| 90 | 90 |
| 91 @pytest.fixture | 91 @pytest.fixture |
| 92 def temp_site_no_project(tmpdir): |
| 93 out_dir = tmpdir.mkdir('temp_site_url') |
| 94 site_dir = out_dir.join('test_site').strpath |
| 95 |
| 96 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) |
| 97 |
| 98 return site_dir |
| 99 |
| 100 |
| 101 @pytest.fixture |
| 92 def intercept(): | 102 def intercept(): |
| 93 app = get_configured_app() | 103 app = get_configured_app() |
| 94 requests_intercept.install() | 104 requests_intercept.install() |
| 95 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) | 105 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) |
| 96 yield app | 106 yield app |
| 97 remove_wsgi_intercept() | 107 remove_wsgi_intercept() |
| 98 | 108 |
| 99 | 109 |
| 100 @pytest.fixture | 110 @pytest.fixture |
| 101 def intercept_populated(): | 111 def intercept_populated(): |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 | 128 |
| 119 | 129 |
| 120 @pytest.fixture | 130 @pytest.fixture |
| 121 def intercept_too_many_targets(): | 131 def intercept_too_many_targets(): |
| 122 targets = ['de_DE', 'es_ES'] | 132 targets = ['de_DE', 'es_ES'] |
| 123 app = get_configured_app(target_langs=targets) | 133 app = get_configured_app(target_langs=targets) |
| 124 requests_intercept.install() | 134 requests_intercept.install() |
| 125 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) | 135 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) |
| 126 yield app | 136 yield app |
| 127 remove_wsgi_intercept() | 137 remove_wsgi_intercept() |
| LEFT | RIGHT |