diff roundup/password.py @ 6638:e1588ae185dc issue2550923_computed_property

merge from default branch. Fix travis.ci so CI builds don't error out
author John Rouillard <rouilj@ieee.org>
date Thu, 21 Apr 2022 16:54:17 -0400
parents 120b0bb05b6e
children 469ad03e6cb8
line wrap: on
line diff
--- a/roundup/password.py	Fri Oct 08 00:37:16 2021 -0400
+++ b/roundup/password.py	Thu Apr 21 16:54:17 2022 -0400
@@ -201,7 +201,10 @@
         s = sha1(s2b(plaintext)).hexdigest()  # nosec
     elif scheme == 'MD5':
         s = md5(s2b(plaintext)).hexdigest()  # nosec
-    elif scheme == 'crypt' and crypt is not None:
+    elif scheme == 'crypt':
+        if crypt is None:
+            raise PasswordValueError(
+                'Unsupported encryption scheme %r' % scheme)
         if other is not None:
             salt = other
         else:
@@ -355,6 +358,8 @@
             raise ValueError('Password not set')
         return '{%s}%s' % (self.scheme, self.password)
 
+def test_missing_crypt():
+    p = encodePassword('sekrit', 'crypt')
 
 def test():
     # SHA
@@ -415,5 +420,6 @@
 
 if __name__ == '__main__':
     test()
+    test_missing_crypt()
 
 # vim: set filetype=python sts=4 sw=4 et si :

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