Commit 6ef27ec3 authored by Philip ABBET's avatar Philip ABBET

[tests] Fix the hopeless rendering of the 500.html page during failed tests

parent a6ad49e7
......@@ -205,8 +205,10 @@ CACHE_ROOT = os.path.join(PREFIX, 'cache')
#
##############################################################################
DATASETS_UID = None
DATASETS_ROOT_PATH = None
DATASETS_UID = 1000
# DATASETS_UID = None
DATASETS_ROOT_PATH = '/Users/pabbet/Projects/databases/'
# DATASETS_ROOT_PATH = None
##############################################################################
......
......@@ -57,6 +57,9 @@ import logging
logger = logging.getLogger(__name__)
#----------------------------------------------------------
def index(request):
'''Our main index page'''
......@@ -64,6 +67,9 @@ def index(request):
context_instance=RequestContext(request))
#----------------------------------------------------------
def login(request):
'''Login page'''
......@@ -78,6 +84,9 @@ def login(request):
return response
#----------------------------------------------------------
def blocked_user_reactivation(request):
'''Reactivation page'''
......@@ -185,6 +194,9 @@ def blocked_user_reactivation(request):
context_instance=RequestContext(request))
#----------------------------------------------------------
def gather_contributions(requestor, author):
'''Gather contributions that are accessible to a certain requestor'''
......@@ -233,6 +245,9 @@ def gather_contributions(requestor, author):
)
#----------------------------------------------------------
def activity_stream(request, author_name):
'''User-specific activity stream'''
......@@ -259,6 +274,9 @@ def activity_stream(request, author_name):
)
#----------------------------------------------------------
@login_required
def docreq(request, author_name):
'''Request a documentation for an existing platform object'''
......@@ -301,6 +319,9 @@ def docreq(request, author_name):
return HttpResponse()
#----------------------------------------------------------
@login_required
def user_settings(request):
'''User settings page (password and token change)'''
......@@ -348,3 +369,16 @@ def user_settings(request):
},
},
context_instance=RequestContext(request))
#----------------------------------------------------------
def empty_error500_for_tests(request):
'''Custom error 500 view used ONLY DURING THE TESTS
Without it, Django tries to render the custom one from the website when an error
occurs in some tests, but fails because some variables needed by the template aren't
found.
'''
return HttpResponse()
......@@ -182,3 +182,8 @@ else:
# Static files (only working during development, when settings.DEBUG is True)
urlpatterns += staticfiles_urlpatterns()
# ONLY DURING THE TESTS: Custom error 500 view
if getattr(settings, 'TEST_CONFIGURATION', False):
handler500 = 'beat.web.ui.views.empty_error500_for_tests'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment