diff test/test_security.py @ 6626:120b0bb05b6e

issue2551191 - Module deprication PEP 594. crypt Handle missing crypt module "better" by raising an exception rather than just silently failing to log in the user when a crypt encoded password can't be checked. Update tests and upgrading.txt too.
author John Rouillard <rouilj@ieee.org>
date Sun, 20 Mar 2022 00:05:59 -0400
parents bdcccd2b2141
children cfdcaf8b5936
line wrap: on
line diff
--- a/test/test_security.py	Sun Mar 13 16:48:31 2022 -0400
+++ b/test/test_security.py	Sun Mar 20 00:05:59 2022 -0400
@@ -411,8 +411,15 @@
         self.assertEqual(has(uimu, 'issue', 'messages.recipients'), 1)
         self.assertEqual(has(uimu, 'issue', 'messages.recipients.username'), 1)
 
-    # roundup.password has its own built-in test, call it.
+    # roundup.password has its own built-in tests, call them.
     def test_password(self):
         roundup.password.test()
 
+        # pretend import of crypt failed
+        orig_crypt = roundup.password.crypt
+        roundup.password.crypt = None
+        with self.assertRaises(roundup.password.PasswordValueError) as ctx:
+            roundup.password.test_missing_crypt()
+        roundup.password.crypt = orig_crypt
+
 # vim: set filetype=python sts=4 sw=4 et si :

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