diff options
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_block.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py index 938cff36..963136b9 100644 --- a/tests/hazmat/primitives/test_block.py +++ b/tests/hazmat/primitives/test_block.py @@ -24,6 +24,11 @@ from cryptography.hazmat.primitives.ciphers import ( ) +@interfaces.register(interfaces.CipherAlgorithm) +class DummyCipher(object): + pass + + class TestCipher(object): def test_instantiate_without_backend(self): Cipher( @@ -45,6 +50,11 @@ class TestCipher(object): ) assert isinstance(cipher.decryptor(), interfaces.CipherContext) + def test_instantiate_with_non_algorithm(self): + algorithm = object() + with pytest.raises(TypeError): + Cipher(algorithm, mode=None) + class TestCipherContext(object): def test_use_after_finalize(self, backend): @@ -90,7 +100,7 @@ class TestCipherContext(object): def test_nonexistent_cipher(self, backend): cipher = Cipher( - object(), object(), backend + DummyCipher(), object(), backend ) with pytest.raises(UnsupportedAlgorithm): cipher.encryptor() |