changeset 588:36c443f4b37f pytest2

added testvalidpassword and testupgradepassword in test_crypto.py
author pkumar <contactprashantat@gmail.com>
date Sat, 25 Jun 2011 09:59:11 +0530
parents e2794fc7f3fb
children accc2bfda374
files MoinMoin/util/_tests/test_crypto.py
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/_tests/test_crypto.py	Sat Jun 25 00:03:57 2011 +0530
+++ b/MoinMoin/util/_tests/test_crypto.py	Sat Jun 25 09:59:11 2011 +0530
@@ -47,7 +47,17 @@
         result = crypto.crypt_password(u'סיסמה סודית בהחלט', salt='12345') # Hebrew
         expected = "{SSHA256}pdYvYv+4Vph259sv/HAm7zpZTv4sBKX9ITOX/m00HMsxMjM0NQ=="
         assert result == expected
+    
+    def testupgradepassword(self):
+        """ return new password hash with better hash """
+        result = crypto.upgrade_password(u'MoinMoin', "junk_hash")
+        assert result.startswith('{SSHA256}')
 
-
+    def testvalidpassword(self):
+        """ validate user password """
+        hash_val = crypto.crypt_password(u"MoinMoin", salt='12345')
+        result = crypto.valid_password(u'MoinMoin', hash_val)
+        assert result
+        
 coverage_modules = ['MoinMoin.util.crypto']