Correct some tests
This commit is contained in:
parent
7beefa537f
commit
6bdff5ac86
3 changed files with 8 additions and 5 deletions
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue