Promotion cohérente avec les tests

This commit is contained in:
Ludovic Stephan 2020-06-19 16:30:53 +02:00
parent 75e7acb233
commit 00458553ad
2 changed files with 7 additions and 7 deletions

View file

@ -117,9 +117,9 @@ class TestOldCASBackend(TestCase):
user = UserModel.objects.create_user(username="johndoe31", password="password") user = UserModel.objects.create_user(username="johndoe31", password="password")
# Decoy user that may be authenticated by mistake # Decoy user that may be authenticated by mistake
UserModel.objects.create_user(username="johndoe", password="password") UserModel.objects.create_user(username="johndoe", password="password")
OldCASAccount.objects.create(user=user, cas_login="johndoe", entrance_year=2019) OldCASAccount.objects.create(user=user, cas_login="johndoe", entrance_year=2014)
auth_user = authenticate( auth_user = authenticate(
None, cas_login="johndoe", entrance_year=2019, password="password" None, cas_login="johndoe", entrance_year=2014, password="password"
) )
self.assertEqual(auth_user, user) self.assertEqual(auth_user, user)

View file

@ -51,9 +51,9 @@ class TestLoginViews(TestCase):
user = UserModel.objects.create_user(username="johndoe31", password="password") user = UserModel.objects.create_user(username="johndoe31", password="password")
# Decoy user that may be authenticated by mistake # Decoy user that may be authenticated by mistake
UserModel.objects.create_user(username="johndoe", password="password") UserModel.objects.create_user(username="johndoe", password="password")
OldCASAccount.objects.create(user=user, cas_login="johndoe", entrance_year=2019) OldCASAccount.objects.create(user=user, cas_login="johndoe", entrance_year=2014)
post_data = dict(cas_login="johndoe", password="password", entrance_year=2019) post_data = dict(cas_login="johndoe", password="password", entrance_year=2014)
response = client.post(url, post_data) response = client.post(url, post_data)
self.assertRedirects(response, settings.LOGIN_REDIRECT_URL) self.assertRedirects(response, settings.LOGIN_REDIRECT_URL)
@ -62,11 +62,11 @@ class TestLoginViews(TestCase):
client = Client() client = Client()
user = UserModel.objects.create_user(username="johndoe31", password="password") user = UserModel.objects.create_user(username="johndoe31", password="password")
OldCASAccount.objects.create(user=user, cas_login="johndoe", entrance_year=2019) OldCASAccount.objects.create(user=user, cas_login="johndoe", entrance_year=2014)
wrong_year = dict(cas_login="johndoe", password="password", entrance_year=2018) wrong_year = dict(cas_login="johndoe", password="password", entrance_year=2015)
wrong_login = dict( wrong_login = dict(
cas_login="johndoe31", password="password", entrance_year=2019 cas_login="johndoe31", password="password", entrance_year=2014
) )
response = client.post(url, wrong_year, follow=True) response = client.post(url, wrong_year, follow=True)