aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-02 14:03:34 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-02 14:03:34 -0700
commitf1a3fc03dc7cecc7658620f342dfd7cf6bb98ba0 (patch)
treefb79a7f804c1cd9b794b5fb3c3f2f2b025094f38 /tests
parent178f6f19a611219f27a0b4e1837134b308de08d2 (diff)
downloadcryptography-f1a3fc03dc7cecc7658620f342dfd7cf6bb98ba0.tar.gz
cryptography-f1a3fc03dc7cecc7658620f342dfd7cf6bb98ba0.tar.bz2
cryptography-f1a3fc03dc7cecc7658620f342dfd7cf6bb98ba0.zip
Document and implement the public API for when the backend doesn't support the requested algorithm
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_block.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py
index e0ed6697..2c0be1b5 100644
--- a/tests/hazmat/primitives/test_block.py
+++ b/tests/hazmat/primitives/test_block.py
@@ -17,6 +17,7 @@ import binascii
import pytest
+from cryptography.exceptions import NoSuchAlgorithm
from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.block import BlockCipher, ciphers, modes
@@ -84,3 +85,13 @@ class TestBlockCipherContext(object):
assert len(pt) == 80
assert pt == b"a" * 80
decryptor.finalize()
+
+ def test_nonexistant_cipher(self, backend):
+ cipher = BlockCipher(
+ object(), object(), backend
+ )
+ with pytest.raises(NoSuchAlgorithm):
+ cipher.encryptor()
+
+ with pytest.raises(NoSuchAlgorithm):
+ cipher.decryptor()