Adds account and puppet to context processor, modifies test.
This commit is contained in:
parent
882e6130e4
commit
4f6b8f323c
2 changed files with 16 additions and 8 deletions
|
|
@ -1,10 +1,8 @@
|
||||||
from mock import Mock, patch
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
from django.test import RequestFactory, TestCase
|
||||||
from django.test import TestCase
|
from mock import MagicMock, patch
|
||||||
|
|
||||||
from . import general_context
|
from . import general_context
|
||||||
|
|
||||||
|
|
||||||
class TestGeneralContext(TestCase):
|
class TestGeneralContext(TestCase):
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
|
|
||||||
|
|
@ -15,8 +13,18 @@ class TestGeneralContext(TestCase):
|
||||||
@patch('evennia.web.utils.general_context.WEBSOCKET_PORT', "websocket_client_port_testvalue")
|
@patch('evennia.web.utils.general_context.WEBSOCKET_PORT', "websocket_client_port_testvalue")
|
||||||
@patch('evennia.web.utils.general_context.WEBSOCKET_URL', "websocket_client_url_testvalue")
|
@patch('evennia.web.utils.general_context.WEBSOCKET_URL', "websocket_client_url_testvalue")
|
||||||
def test_general_context(self):
|
def test_general_context(self):
|
||||||
request = Mock()
|
request = RequestFactory().get('/')
|
||||||
self.assertEqual(general_context.general_context(request), {
|
request.user = AnonymousUser()
|
||||||
|
request.session = {
|
||||||
|
'account': None,
|
||||||
|
'puppet': None,
|
||||||
|
}
|
||||||
|
|
||||||
|
response = general_context.general_context(request)
|
||||||
|
|
||||||
|
self.assertEqual(response, {
|
||||||
|
'account': None,
|
||||||
|
'puppet': None,
|
||||||
'game_name': "test_name",
|
'game_name': "test_name",
|
||||||
'game_slogan': "test_game_slogan",
|
'game_slogan': "test_game_slogan",
|
||||||
'evennia_userapps': ['Accounts'],
|
'evennia_userapps': ['Accounts'],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue