diff options
Diffstat (limited to 'tests/primitives/test_hashes.py')
-rw-r--r-- | tests/primitives/test_hashes.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/primitives/test_hashes.py b/tests/primitives/test_hashes.py index 2efda050..174fd5f4 100644 --- a/tests/primitives/test_hashes.py +++ b/tests/primitives/test_hashes.py @@ -39,17 +39,18 @@ class TestBaseHash(object): class TestCopyHash(object): def test_copy_backend_object(self): - pretend_backend = pretend.stub(copy_hash_context=lambda a: "copiedctx") + pretend_hashes = pretend.stub(copy_ctx=lambda a: "copiedctx") + pretend_backend = pretend.stub(hashes=pretend_hashes) pretend_ctx = pretend.stub() h = hashes.SHA1(backend=pretend_backend, ctx=pretend_ctx) assert h._backend is pretend_backend assert h.copy()._backend is h._backend -class TestDefaultAPISHA1(object): +class TestDefaultBackendSHA1(object): def test_default_backend_creation(self): """ - This test assumes the presence of SHA1 in the default API. + This test assumes the presence of SHA1 in the default backend. """ h = hashes.SHA1() assert h._backend is _default_backend @@ -60,7 +61,7 @@ class TestSHA1(object): hashes.SHA1, digest_size=20, block_size=64, - only_if=lambda backend: backend.supports_hash(hashes.SHA1), + only_if=lambda backend: backend.hashes.supported(hashes.SHA1), skip_message="Does not support SHA1", ) @@ -70,7 +71,7 @@ class TestSHA224(object): hashes.SHA224, digest_size=28, block_size=64, - only_if=lambda backend: backend.supports_hash(hashes.SHA224), + only_if=lambda backend: backend.hashes.supported(hashes.SHA224), skip_message="Does not support SHA224", ) @@ -80,7 +81,7 @@ class TestSHA256(object): hashes.SHA256, digest_size=32, block_size=64, - only_if=lambda backend: backend.supports_hash(hashes.SHA256), + only_if=lambda backend: backend.hashes.supported(hashes.SHA256), skip_message="Does not support SHA256", ) @@ -90,7 +91,7 @@ class TestSHA384(object): hashes.SHA384, digest_size=48, block_size=128, - only_if=lambda backend: backend.supports_hash(hashes.SHA384), + only_if=lambda backend: backend.hashes.supported(hashes.SHA384), skip_message="Does not support SHA384", ) @@ -100,7 +101,7 @@ class TestSHA512(object): hashes.SHA512, digest_size=64, block_size=128, - only_if=lambda backend: backend.supports_hash(hashes.SHA512), + only_if=lambda backend: backend.hashes.supported(hashes.SHA512), skip_message="Does not support SHA512", ) @@ -110,7 +111,7 @@ class TestRIPEMD160(object): hashes.RIPEMD160, digest_size=20, block_size=64, - only_if=lambda backend: backend.supports_hash(hashes.RIPEMD160), + only_if=lambda backend: backend.hashes.supported(hashes.RIPEMD160), skip_message="Does not support RIPEMD160", ) @@ -120,7 +121,7 @@ class TestWhirlpool(object): hashes.Whirlpool, digest_size=64, block_size=64, - only_if=lambda backend: backend.supports_hash(hashes.Whirlpool), + only_if=lambda backend: backend.hashes.supported(hashes.Whirlpool), skip_message="Does not support Whirlpool", ) @@ -130,6 +131,6 @@ class TestMD5(object): hashes.MD5, digest_size=16, block_size=64, - only_if=lambda backend: backend.supports_hash(hashes.MD5), + only_if=lambda backend: backend.hashes.supported(hashes.MD5), skip_message="Does not support MD5", ) |