Browse Source

secrets: imported SecretValidationHasher.iterations for SecretTestCase

Zach Moody 8 years ago
parent
commit
f7e768d166
1 changed files with 2 additions and 1 deletions
  1. 2 1
      netbox/secrets/tests/test_models.py

+ 2 - 1
netbox/secrets/tests/test_models.py

@@ -6,6 +6,7 @@ from django.core.exceptions import ValidationError
 from django.test import TestCase
 from django.test import TestCase
 
 
 from secrets.models import UserKey, Secret, generate_master_key, encrypt_master_key, decrypt_master_key
 from secrets.models import UserKey, Secret, generate_master_key, encrypt_master_key, decrypt_master_key
+from secrets.hashers import SecretValidationHasher
 
 
 
 
 class UserKeyTestCase(TestCase):
 class UserKeyTestCase(TestCase):
@@ -100,7 +101,7 @@ class SecretTestCase(TestCase):
         # Ensure proper hashing algorithm is used
         # Ensure proper hashing algorithm is used
         hasher, iterations, salt, sha256 = s.hash.split('$')
         hasher, iterations, salt, sha256 = s.hash.split('$')
         self.assertEqual(hasher, 'pbkdf2_sha256', "Hashing algorithm has been modified to: {}".format(hasher))
         self.assertEqual(hasher, 'pbkdf2_sha256', "Hashing algorithm has been modified to: {}".format(hasher))
-        self.assertGreaterEqual(int(iterations), 24000, "Insufficient iteration count ({}) for hash".format(iterations))
+        self.assertGreaterEqual(int(iterations), SecretValidationHasher.iterations, "Insufficient iteration count ({}) for hash".format(iterations))
         self.assertGreaterEqual(len(salt), 12, "Hash salt is too short ({} chars)".format(len(salt)))
         self.assertGreaterEqual(len(salt), 12, "Hash salt is too short ({} chars)".format(len(salt)))
 
 
         # Test hash validation
         # Test hash validation