ops: added redirect and exception ops view for testing.
This commit is contained in:
parent
ebc5609e99
commit
25666c0871
3 changed files with 32 additions and 1 deletions
|
|
@ -25,6 +25,12 @@ def admin_routes(config):
|
|||
config.add_route(
|
||||
name='ops_ping',
|
||||
pattern='/ping')
|
||||
config.add_route(
|
||||
name='ops_error_test',
|
||||
pattern='/error')
|
||||
config.add_route(
|
||||
name='ops_redirect_test',
|
||||
pattern='/redirect')
|
||||
|
||||
|
||||
def includeme(config):
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
# RhodeCode Enterprise Edition, including its added features, Support services,
|
||||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||
|
||||
import time
|
||||
import logging
|
||||
|
||||
from pyramid.view import view_config
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
|
||||
from rhodecode.apps._base import BaseAppView
|
||||
|
||||
from rhodecode.lib import helpers as h
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -50,5 +52,26 @@ class OpsView(BaseAppView):
|
|||
})
|
||||
return {'ok': data}
|
||||
|
||||
@view_config(
|
||||
route_name='ops_error_test', request_method='GET',
|
||||
renderer='json_ext')
|
||||
def ops_error_test(self):
|
||||
"""
|
||||
Test exception handling and emails on errors
|
||||
"""
|
||||
class TestException(Exception):
|
||||
pass
|
||||
|
||||
msg = ('RhodeCode Enterprise test exception. '
|
||||
'Generation time: {}'.format(time.time()))
|
||||
raise TestException(msg)
|
||||
|
||||
@view_config(
|
||||
route_name='ops_redirect_test', request_method='GET',
|
||||
renderer='json_ext')
|
||||
def ops_redirect_test(self):
|
||||
"""
|
||||
Test redirect handling
|
||||
"""
|
||||
redirect_to = self.request.GET.get('to') or h.route_path('home')
|
||||
raise HTTPFound(redirect_to)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ function registerRCRoutes() {
|
|||
pyroutes.register('repo_integrations_create', '/%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']);
|
||||
pyroutes.register('repo_integrations_edit', '/%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']);
|
||||
pyroutes.register('ops_ping', '/_admin/ops/ping', []);
|
||||
pyroutes.register('ops_error_test', '/_admin/ops/error', []);
|
||||
pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []);
|
||||
pyroutes.register('admin_home', '/_admin', []);
|
||||
pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []);
|
||||
pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue