Moved BasePasswordHasher tests to its own test case.

This commit is contained in:
Mads Jensen 2017-09-28 21:52:11 +02:00 committed by Tim Graham
parent 259fec8de0
commit 776f6902d9
1 changed files with 6 additions and 1 deletions

View File

@ -429,10 +429,15 @@ class TestUtilsHashPass(SimpleTestCase):
check_password('wrong_password', encoded)
self.assertEqual(hasher.harden_runtime.call_count, 1)
class BasePasswordHasherTests(SimpleTestCase):
def setUp(self):
self.hasher = BasePasswordHasher()
def test_load_library_no_algorithm(self):
msg = "Hasher 'BasePasswordHasher' doesn't specify a library attribute"
with self.assertRaisesMessage(ValueError, msg):
BasePasswordHasher()._load_library()
self.hasher._load_library()
def test_load_library_importerror(self):
PlainHasher = type('PlainHasher', (BasePasswordHasher,), {'algorithm': 'plain', 'library': 'plain'})