Show More
@@ -158,6 +158,8 b' def load_pyramid_environment(global_conf' | |||||
158 | # This has to be done before the database connection is initialized. |
|
158 | # This has to be done before the database connection is initialized. | |
159 | if settings['is_test']: |
|
159 | if settings['is_test']: | |
160 | rhodecode.is_test = True |
|
160 | rhodecode.is_test = True | |
|
161 | rhodecode.disable_error_handler = True | |||
|
162 | ||||
161 | utils.initialize_test_environment(settings_merged) |
|
163 | utils.initialize_test_environment(settings_merged) | |
162 |
|
164 | |||
163 | # Initialize the database connection. |
|
165 | # Initialize the database connection. |
@@ -221,7 +221,8 b' def make_not_found_view(config):' | |||||
221 | except Exception as e: |
|
221 | except Exception as e: | |
222 | log.exception(e) |
|
222 | log.exception(e) | |
223 |
|
223 | |||
224 |
if settings.get('debugtoolbar.enabled', False) |
|
224 | if (settings.get('debugtoolbar.enabled', False) or | |
|
225 | rhodecode.disable_error_handler): | |||
225 | raise |
|
226 | raise | |
226 |
|
227 | |||
227 | if isinstance(e, VCSCommunicationError): |
|
228 | if isinstance(e, VCSCommunicationError): |
@@ -20,6 +20,7 b'' | |||||
20 |
|
20 | |||
21 | import mock |
|
21 | import mock | |
22 | import pytest |
|
22 | import pytest | |
|
23 | import rhodecode | |||
23 | import rhodecode.lib.vcs.client as client |
|
24 | import rhodecode.lib.vcs.client as client | |
24 |
|
25 | |||
25 | @pytest.mark.usefixtures('autologin_user', 'app') |
|
26 | @pytest.mark.usefixtures('autologin_user', 'app') | |
@@ -34,9 +35,13 b' def test_vcs_available_returns_summary_p' | |||||
34 | def test_vcs_unavailable_returns_vcs_error_page(app, backend): |
|
35 | def test_vcs_unavailable_returns_vcs_error_page(app, backend): | |
35 | url = '/{repo_name}'.format(repo_name=backend.repo.repo_name) |
|
36 | url = '/{repo_name}'.format(repo_name=backend.repo.repo_name) | |
36 |
|
37 | |||
37 | with mock.patch.object(client, '_get_proxy_method') as p: |
|
38 | try: | |
38 | p.side_effect = client.exceptions.PyroVCSCommunicationError() |
|
39 | rhodecode.disable_error_handler = False | |
39 | response = app.get(url, expect_errors=True) |
|
40 | with mock.patch.object(client, '_get_proxy_method') as p: | |
|
41 | p.side_effect = client.exceptions.PyroVCSCommunicationError() | |||
|
42 | response = app.get(url, expect_errors=True) | |||
|
43 | finally: | |||
|
44 | rhodecode.disable_error_handler = True | |||
40 |
|
45 | |||
41 | assert response.status_code == 502 |
|
46 | assert response.status_code == 502 | |
42 | assert 'Could not connect to VCS Server' in response.body |
|
47 | assert 'Could not connect to VCS Server' in response.body |
General Comments 0
You need to be logged in to leave comments.
Login now