OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 def temp_site_function_scope(tmpdir): | 69 def temp_site_function_scope(tmpdir): |
70 out_dir = tmpdir.mkdir('temp_site_func') | 70 out_dir = tmpdir.mkdir('temp_site_func') |
71 site_dir = out_dir.join('test_site').strpath | 71 site_dir = out_dir.join('test_site').strpath |
72 | 72 |
73 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) | 73 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) |
74 | 74 |
75 return site_dir | 75 return site_dir |
76 | 76 |
77 | 77 |
78 @pytest.fixture | 78 @pytest.fixture |
| 79 def temp_site_url_in_config(tmpdir): |
| 80 out_dir = tmpdir.mkdir('temp_site_url') |
| 81 site_dir = out_dir.join('test_site').strpath |
| 82 |
| 83 shutil.copytree(os.path.join(ROOTPATH, 'tests', 'test_site'), site_dir) |
| 84 |
| 85 with FileSource(str(site_dir)) as fs: |
| 86 fs.write_to_config('XTM', 'url', 'www.bar.com') |
| 87 |
| 88 return site_dir |
| 89 |
| 90 |
| 91 @pytest.fixture |
79 def intercept(): | 92 def intercept(): |
80 app = get_configured_app() | 93 app = get_configured_app() |
81 requests_intercept.install() | 94 requests_intercept.install() |
82 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) | 95 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) |
83 yield app | 96 yield app |
84 remove_wsgi_intercept() | 97 remove_wsgi_intercept() |
85 | 98 |
86 | 99 |
87 @pytest.fixture | 100 @pytest.fixture |
88 def intercept_populated(): | 101 def intercept_populated(): |
(...skipping 16 matching lines...) Expand all Loading... |
105 | 118 |
106 | 119 |
107 @pytest.fixture | 120 @pytest.fixture |
108 def intercept_too_many_targets(): | 121 def intercept_too_many_targets(): |
109 targets = ['de_DE', 'es_ES'] | 122 targets = ['de_DE', 'es_ES'] |
110 app = get_configured_app(target_langs=targets) | 123 app = get_configured_app(target_langs=targets) |
111 requests_intercept.install() | 124 requests_intercept.install() |
112 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) | 125 add_wsgi_intercept(_INTERCEPT_HOST, _INTERCEPT_PORT, lambda: app) |
113 yield app | 126 yield app |
114 remove_wsgi_intercept() | 127 remove_wsgi_intercept() |
OLD | NEW |