mirror of
https://github.com/evennia/evennia.git
synced 2026-03-25 09:16:32 +01:00
Returns 404 if webclient is supposed to be disabled.
This commit is contained in:
parent
d584fda9e6
commit
09d982eb48
2 changed files with 18 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ page and serve it eventual static content.
|
|||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from django.conf import settings
|
||||
from django.http import Http404
|
||||
from django.shortcuts import render
|
||||
from django.contrib.auth import login, authenticate
|
||||
|
||||
|
|
@ -19,6 +21,10 @@ def webclient(request):
|
|||
"""
|
||||
# auto-login is now handled by evennia.web.utils.middleware
|
||||
|
||||
# check if webclient should be enabled
|
||||
if not settings.WEBCLIENT_ENABLED:
|
||||
raise Http404
|
||||
|
||||
# make sure to store the browser session's hash so the webclient can get to it!
|
||||
pagevars = {'browser_sessid': request.session.session_key}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,18 @@ class PasswordResetTest(EvenniaWebTest):
|
|||
class WebclientTest(EvenniaWebTest):
|
||||
url_name = 'webclient:index'
|
||||
|
||||
@override_settings(WEBCLIENT_ENABLED=True)
|
||||
def test_get(self):
|
||||
self.authenticated_response = 200
|
||||
self.unauthenticated_response = 200
|
||||
super(WebclientTest, self).test_get()
|
||||
|
||||
@override_settings(WEBCLIENT_ENABLED=False)
|
||||
def test_get_disabled(self):
|
||||
self.authenticated_response = 404
|
||||
self.unauthenticated_response = 404
|
||||
super(WebclientTest, self).test_get()
|
||||
|
||||
class ChannelListTest(EvenniaWebTest):
|
||||
url_name = 'channels'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue