Skip to content
Permalink
Browse files

fixup! add test for rehash on login for parameter update

  • Loading branch information...
Arvedui committed Mar 13, 2019
1 parent 0a7a7a1 commit bd2ad0ce3f0f8c2b1ba55306423b78fe0d535fd5
Showing with 8 additions and 8 deletions.
  1. +8 −8 modoboa/core/tests/test_authentication.py
@@ -122,12 +122,11 @@ def test_password_parameter_change(self):

self.client.logout()
with self.settings(
MODOBOA_ARGON2_TIME_COST=4,
MODOBOA_ARGON2_MEMORY_COST=10000,
MODOBOA_ARGON2_PARALLELISM=4):
MODOBOA_ARGON2_TIME_COST=4,
MODOBOA_ARGON2_MEMORY_COST=10000,
MODOBOA_ARGON2_PARALLELISM=4):
self.client.post(reverse("core:login"), data)
user.refresh_from_db()
print(user.password)
self.assertTrue(user.password.startswith("{ARGON2ID}"))
parameters = argon2.extract_parameters(user.password.lstrip("{ARGON2ID}"))
self.assertEqual(parameters.time_cost, 4)
@@ -136,13 +135,14 @@ def test_password_parameter_change(self):

self.client.logout()
with self.settings(
MODOBOA_ARGON2_TIME_COST=3,
MODOBOA_ARGON2_MEMORY_COST=1000,
MODOBOA_ARGON2_PARALLELISM=2):
MODOBOA_ARGON2_TIME_COST=3,
MODOBOA_ARGON2_MEMORY_COST=1000,
MODOBOA_ARGON2_PARALLELISM=2):
self.client.post(reverse("core:login"), data)
user.refresh_from_db()
self.assertTrue(user.password.startswith("{ARGON2ID}"))
parameters = argon2.extract_parameters(user.password.lstrip("{ARGON2ID}"))
parameters = argon2.extract_parameters(
user.password.lstrip("{ARGON2ID}"))
self.assertEqual(parameters.time_cost, 3)
self.assertEqual(parameters.memory_cost, 1000)
self.assertEqual(parameters.parallelism, 2)

0 comments on commit bd2ad0c

Please sign in to comment.
You can’t perform that action at this time.