diff roundup/password.py @ 8548:98011edc6c60

refactor: remove duplicate code block Had the same code inside two different if statements. Replaced with 'if X in [ a, b ] ' and only one copy of the code.
author John Rouillard <rouilj@ieee.org>
date Thu, 26 Mar 2026 21:46:19 -0400
parents 6bd11a73f2ed
children
line wrap: on
line diff
--- a/roundup/password.py	Wed Mar 25 18:00:19 2026 -0400
+++ b/roundup/password.py	Thu Mar 26 21:46:19 2026 -0400
@@ -430,21 +430,10 @@
 
         if rounds < 1000:
             return True
-
-        if (self.scheme == "PBKDF2"):
+        if self.scheme in ["PBKDF2S5", "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
-
-        if (self.scheme == "PBKDF2S5"):
-            new_rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
+            # PYTEST_CURRENT_TEST is set when pytest is running
+            # a test case.
             if ("pytest" in sys.modules and
                 "PYTEST_CURRENT_TEST" in os.environ):
                 if ("PYTEST_USE_CONFIG" in os.environ):

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