Commits

Kelvin Wong committed 6aebaba

Remove text literals and clean up test suite

Comments (0)

Files changed (1)

tests/test_django_scrypt.py

 
     def test_encoder_specified_scrypt_hasher(self):
         """Test hasher is obtained by name"""
-        encoded = make_password('letmein', hasher='scrypt')
+        encoded = make_password(self.password, hasher='scrypt')
         self.assertTrue(check_password(self.password, encoded))
 
     def test_encoder_hash_usable(self):
         self.assertTrue(check_password(self.password, self.encoded_hash))
 
     def test_verify_old_hash_format_raises_error(self):
-        """Test that old encoded format raises error"""
+        """Test that deprecated, old encoded hash format raises an Exception
+
+        The old format hashes store N == 16384 whereas new format store Nexp == 14.
+        The fix is to replace 16384 with 14 in each hash.
+        """
         with self.assertRaises(Exception) as cm:
             check_password(self.password, self.old_format_encoded_hash)
         self.assertEqual(
 
     def test_verify_old_hash_format_fixable(self):
         """Test deprecated encoded format can be fixed by swapping Nexp for N
-        
+
         Specifically, replace 16384 with 14 at position 3 of the encoded hash
         """
         self.assertTrue(check_password(self.password, self.old_format_fix_encoded_hash))
     def test_no_upgrade_on_incorrect_pass(self):
         self.assertEqual('scrypt', get_hasher('default').algorithm)
         for algo in ('sha1', 'md5'):
-            encoded = make_password('letmein', hasher=algo)
+            encoded = make_password(self.password, hasher=algo)
             state = {'upgraded': False}
 
             def setter():
             self.assertFalse(state['upgraded'])
 
     def test_no_upgrade(self):
-        encoded = make_password('letmein')
+        encoded = make_password(self.password)
         state = {'upgraded': False}
 
         def setter():
     def test_upgrade(self):
         self.assertEqual('scrypt', get_hasher('default').algorithm)
         for algo in ('sha1', 'md5'):
-            encoded = make_password('letmein', hasher=algo)
+            encoded = make_password(self.password, hasher=algo)
             state = {'upgraded': False}
 
             def setter(password):
                 state['upgraded'] = True
-            self.assertTrue(check_password('letmein', encoded, setter))
+            self.assertTrue(check_password(self.password, encoded, setter))
             self.assertTrue(state['upgraded'])