diff 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
line wrap: on
line diff
--- a/roundup/password.py	Sun Feb 26 15:38:49 2023 -0500
+++ b/roundup/password.py	Sun Feb 26 16:17:37 2023 -0500
@@ -379,6 +379,13 @@
             return True
         if (self.scheme == "PBKDF2"):
             new_rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
+            if ("pytest" in sys.modules and 
+                "PYTEST_CURRENT_TEST" in os.environ):
+                if ("PYTEST_USE_CONFIG" in os.environ):
+                    new_rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
+                else:
+                    # for testing
+                    new_rounds = 1000
             if rounds < int(new_rounds):
                 return True
         return False

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