From f7e768d166b6f3e517c7aed4a151243f63d6735b Mon Sep 17 00:00:00 2001 From: Zach Moody Date: Thu, 23 Jun 2016 00:01:22 -0500 Subject: [PATCH] secrets: imported SecretValidationHasher.iterations for SecretTestCase --- netbox/secrets/tests/test_models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/secrets/tests/test_models.py b/netbox/secrets/tests/test_models.py index 10a719077..132487765 100644 --- a/netbox/secrets/tests/test_models.py +++ b/netbox/secrets/tests/test_models.py @@ -6,6 +6,7 @@ from django.core.exceptions import ValidationError from django.test import TestCase from secrets.models import UserKey, Secret, generate_master_key, encrypt_master_key, decrypt_master_key +from secrets.hashers import SecretValidationHasher class UserKeyTestCase(TestCase): @@ -100,7 +101,7 @@ class SecretTestCase(TestCase): # Ensure proper hashing algorithm is used hasher, iterations, salt, sha256 = s.hash.split('$') 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))) # Test hash validation