comparison roundup/password.py @ 7184:8b2287d850c8

Fix round check/settings in needs_migration Support test rounds in needs_migration Two test were missing os.environ seting to have them use config setting.
author John Rouillard <rouilj@ieee.org>
date Sun, 26 Feb 2023 16:17:37 -0500
parents 2de72f75f2f8
children 8e8d111fcdcd
comparison
equal deleted inserted replaced
7183:2de72f75f2f8 7184:8b2287d850c8
377 rounds, salt, raw_salt, digest = pbkdf2_unpack(self.password) 377 rounds, salt, raw_salt, digest = pbkdf2_unpack(self.password)
378 if rounds < 1000: 378 if rounds < 1000:
379 return True 379 return True
380 if (self.scheme == "PBKDF2"): 380 if (self.scheme == "PBKDF2"):
381 new_rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS 381 new_rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
382 if ("pytest" in sys.modules and
383 "PYTEST_CURRENT_TEST" in os.environ):
384 if ("PYTEST_USE_CONFIG" in os.environ):
385 new_rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
386 else:
387 # for testing
388 new_rounds = 1000
382 if rounds < int(new_rounds): 389 if rounds < int(new_rounds):
383 return True 390 return True
384 return False 391 return False
385 392
386 def unpack(self, encrypted, scheme=None, strict=False, config=None): 393 def unpack(self, encrypted, scheme=None, strict=False, config=None):

Roundup Issue Tracker: http://roundup-tracker.org/