Commit 6b007f39 authored by Valentin Samir's avatar Valentin Samir
Browse files


parent cd57f101
......@@ -75,6 +75,45 @@ class LoginTestCase(TestCase, BaseServicePattern, CanLogin):
response = client.get("/login")
self.assertNotIn(b"A new version of the application is available", response.content)
def test_messages_info_box_enabled(self):
"""test that the message info-box is displayed then enabled"""
client = Client()
response = client.get("/login")
b"The Central Authentication Service grants you access to most of our websites by ",
def test_messages_info_box_disabled(self):
"""test that the message info-box is not displayed then disabled"""
client = Client()
response = client.get("/login")
b"The Central Authentication Service grants you access to most of our websites by ",
# test1 and test2 are malformed and should be ignored, test3 is ok, test5 do not
# exists and should be ignored
@override_settings(CAS_INFO_MESSAGES_ORDER=["test1", "test2", "test3", "test5"])
"test1": "test", # not a dict, should be ignored
"test2": {"type": "success"}, # not "message" key, should be ignored
"test3": {"message": "test3"},
"test4": {"message": "test4"},
def test_messages_info_box_bad_messages(self):
"""test that mal formated messages dict are ignored"""
client = Client()
# not errors should be raises
response = client.get("/login")
# test3 is ok est should be there
self.assertIn(b"test3", response.content)
# test4 is not in CAS_INFO_MESSAGES_ORDER and should not be there
self.assertNotIn(b"test4", response.content)
def test_login_view_post_goodpass_goodlt(self):
"""Test a successul login"""
# we get a client who fetch a frist time the login page and the login form default
......@@ -78,10 +78,9 @@ def context(params):
params["CAS_INFO_RENDER"] = []
for msg_name in settings.CAS_INFO_MESSAGES_ORDER:
if msg_name in settings.CAS_INFO_MESSAGES:
msg = settings.CAS_INFO_MESSAGES[msg_name].copy()
except AttributeError:
if not isinstance(settings.CAS_INFO_MESSAGES[msg_name], dict):
msg = settings.CAS_INFO_MESSAGES[msg_name].copy()
if "message" in msg:
msg["name"] = msg_name
# use info as default infox type
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