Merge pull request #1733 from strikaco/webclientdisable

Returns 404 if webclient is supposed to be disabled (fixes #1731)
This commit is contained in:
Griatch 2018-10-30 22:17:37 +01:00 committed by GitHub
commit d8351d2a8d
2 changed files with 18 additions and 0 deletions

View file

@ -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}

View file

@ -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'