@@ -303,7 +303,33 @@ def test_check_password_valid(self, user_service, metrics):
303
303
),
304
304
]
305
305
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 ):
307
333
user = UserFactory .create ()
308
334
password = user .password
309
335
user_service .hasher = pretend .stub (
0 commit comments