Commit 6bdff5ac authored by Valentin Samir's avatar Valentin Samir

Correct some tests

parent 7beefa53
......@@ -281,7 +281,7 @@ class LoginView(View, LogoutMixin):
)
if self.ajax:
data = {"status": "error", "detail": "confirmation needed"}
return JsonResponse(request, data)
return JsonResponse(self.request, data)
else:
return render(
self.request,
......@@ -291,7 +291,7 @@ class LoginView(View, LogoutMixin):
service_pattern,
renew=self.renew
)}
)
)
else:
# redirect, using method ?
list(messages.get_messages(self.request)) # clean messages before leaving django
......
......@@ -128,6 +128,9 @@ class DummySession(dict):
def set_expiry(self, int):
pass
def flush(self):
self.clear()
class DummyQuerySet(set):
pass
......@@ -18,7 +18,7 @@ def test_login_view_post_goodpass_goodlt():
request = factory.post('/login', {'username':'test', 'password':'test', 'lt':'LT-random'})
request.session = DummySession()
request.session['lt'] = 'LT-random'
request.session['lt'] = ['LT-random']
request.session["username"] = os.urandom(20)
request.session["warn"] = os.urandom(20)
......@@ -38,7 +38,7 @@ def test_login_view_post_badlt():
request = factory.post('/login', {'username':'test', 'password':'test', 'lt':'LT-random1'})
request.session = DummySession()
request.session['lt'] = 'LT-random2'
request.session['lt'] = ['LT-random2']
authenticated = os.urandom(20)
username = os.urandom(20)
......@@ -63,7 +63,7 @@ def test_login_view_post_badpass_good_lt():
request = factory.post('/login', {'username':'test', 'password':'badpassword', 'lt':'LT-random'})
request.session = DummySession()
request.session['lt'] = 'LT-random'
request.session['lt'] = ['LT-random']
login = LoginView()
login.init_post(request)
......
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