Moved BasePasswordHasher tests to its own test case.
This commit is contained in:
parent
259fec8de0
commit
776f6902d9
|
@ -429,10 +429,15 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||||
check_password('wrong_password', encoded)
|
check_password('wrong_password', encoded)
|
||||||
self.assertEqual(hasher.harden_runtime.call_count, 1)
|
self.assertEqual(hasher.harden_runtime.call_count, 1)
|
||||||
|
|
||||||
|
|
||||||
|
class BasePasswordHasherTests(SimpleTestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.hasher = BasePasswordHasher()
|
||||||
|
|
||||||
def test_load_library_no_algorithm(self):
|
def test_load_library_no_algorithm(self):
|
||||||
msg = "Hasher 'BasePasswordHasher' doesn't specify a library attribute"
|
msg = "Hasher 'BasePasswordHasher' doesn't specify a library attribute"
|
||||||
with self.assertRaisesMessage(ValueError, msg):
|
with self.assertRaisesMessage(ValueError, msg):
|
||||||
BasePasswordHasher()._load_library()
|
self.hasher._load_library()
|
||||||
|
|
||||||
def test_load_library_importerror(self):
|
def test_load_library_importerror(self):
|
||||||
PlainHasher = type('PlainHasher', (BasePasswordHasher,), {'algorithm': 'plain', 'library': 'plain'})
|
PlainHasher = type('PlainHasher', (BasePasswordHasher,), {'algorithm': 'plain', 'library': 'plain'})
|
||||||
|
|
Loading…
Reference in New Issue