##// END OF EJS Templates
ops: added redirect and exception ops view for testing.
marcink -
r1913:edd50f39 default
parent child Browse files
Show More
@@ -25,6 +25,12 b' def admin_routes(config):'
25 25 config.add_route(
26 26 name='ops_ping',
27 27 pattern='/ping')
28 config.add_route(
29 name='ops_error_test',
30 pattern='/error')
31 config.add_route(
32 name='ops_redirect_test',
33 pattern='/redirect')
28 34
29 35
30 36 def includeme(config):
@@ -18,12 +18,14 b''
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 import time
21 22 import logging
22 23
23 24 from pyramid.view import view_config
25 from pyramid.httpexceptions import HTTPFound
24 26
25 27 from rhodecode.apps._base import BaseAppView
26
28 from rhodecode.lib import helpers as h
27 29
28 30 log = logging.getLogger(__name__)
29 31
@@ -50,5 +52,26 b' class OpsView(BaseAppView):'
50 52 })
51 53 return {'ok': data}
52 54
55 @view_config(
56 route_name='ops_error_test', request_method='GET',
57 renderer='json_ext')
58 def ops_error_test(self):
59 """
60 Test exception handling and emails on errors
61 """
62 class TestException(Exception):
63 pass
53 64
65 msg = ('RhodeCode Enterprise test exception. '
66 'Generation time: {}'.format(time.time()))
67 raise TestException(msg)
54 68
69 @view_config(
70 route_name='ops_redirect_test', request_method='GET',
71 renderer='json_ext')
72 def ops_redirect_test(self):
73 """
74 Test redirect handling
75 """
76 redirect_to = self.request.GET.get('to') or h.route_path('home')
77 raise HTTPFound(redirect_to)
@@ -60,6 +60,8 b' function registerRCRoutes() {'
60 60 pyroutes.register('repo_integrations_create', '/%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']);
61 61 pyroutes.register('repo_integrations_edit', '/%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']);
62 62 pyroutes.register('ops_ping', '/_admin/ops/ping', []);
63 pyroutes.register('ops_error_test', '/_admin/ops/error', []);
64 pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []);
63 65 pyroutes.register('admin_home', '/_admin', []);
64 66 pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []);
65 67 pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']);
General Comments 0
You need to be logged in to leave comments. Login now