Skip to content

Commit 32677e1

Browse files
committed
add a diaper test to ensure we don't regress on passlib funcitonality
1 parent 8556f88 commit 32677e1

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/unit/accounts/test_services.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,33 @@ def test_check_password_valid(self, user_service, metrics):
303303
),
304304
]
305305

306-
def test_check_password_updates(self, user_service):
306+
@pytest.mark.parametrize(
307+
"password",
308+
[
309+
(
310+
"$argon2id$v=19$m=8,t=1,p=1$"
311+
"w/gfo5QSQihFyHlvDcE4pw$Hd4KENg+xDlq2bfeGUEYSieIXXL/c1NfTr0ZkYueO2Y"
312+
),
313+
(
314+
"$bcrypt-sha256$v=2,t=2b,r=12$"
315+
"DqC0lms6x9Dh6XesvIJvVe$hBbYe9JfdjyorOFcS3rv5BhmuSIyXD6"
316+
),
317+
"$2b$12$2t/EVU3H9b3c5iR6GdELZOwCoyrT518DgCpNxHbX.S1IxV6eEEDhC",
318+
"bcrypt$$2b$12$EhhZDxGr/7HIKYRGMngC.O4sQx68vkaISSnSGZ6s8iOfaGy6l9cma",
319+
],
320+
)
321+
def test_check_password_updates(self, user_service, password):
322+
"""
323+
This test confirms passlib is actually working,
324+
see https://github.com/pypi/warehouse/issues/15454
325+
"""
326+
user = UserFactory.create(password=password)
327+
328+
assert user_service.check_password(user.id, "password")
329+
assert user.password.startswith("$argon2id$v=19$m=1024,t=6,p=6$")
330+
assert user_service.check_password(user.id, "password")
331+
332+
def test_hash_is_upgraded(self, user_service):
307333
user = UserFactory.create()
308334
password = user.password
309335
user_service.hasher = pretend.stub(

0 commit comments

Comments
 (0)