aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-03-16 14:36:17 +0800
committerAyrx <terrycwk1994@gmail.com>2014-03-16 14:36:17 +0800
commitf56c54e36ce06e8e29691c3c4dfd000e8477a41d (patch)
tree4a3e86f945b37c950b35d8eb0d11930485c907d4 /tests/hazmat/primitives
parent3fb221f1fb02ffed7a558bd06ba41bb75c329fc5 (diff)
downloadcryptography-f56c54e36ce06e8e29691c3c4dfd000e8477a41d.tar.gz
cryptography-f56c54e36ce06e8e29691c3c4dfd000e8477a41d.tar.bz2
cryptography-f56c54e36ce06e8e29691c3c4dfd000e8477a41d.zip
Added backend check to cipher primitives
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r--tests/hazmat/primitives/test_ciphers.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py
index d9f83535..dfed63a8 100644
--- a/tests/hazmat/primitives/test_ciphers.py
+++ b/tests/hazmat/primitives/test_ciphers.py
@@ -14,9 +14,13 @@
from __future__ import absolute_import, division, print_function
import binascii
+from cryptography.hazmat.primitives.ciphers.modes import ECB
import pytest
+from cryptography.exceptions import UnsupportedInterface
+
+from cryptography.hazmat.primitives import ciphers
from cryptography.hazmat.primitives.ciphers.algorithms import (
AES, Camellia, TripleDES, Blowfish, ARC4, CAST5, IDEA
)
@@ -120,3 +124,10 @@ class TestIDEA(object):
def test_invalid_key_size(self):
with pytest.raises(ValueError):
IDEA(b"\x00" * 17)
+
+
+def test_invalid_backend():
+ pretend_backend = object()
+
+ with pytest.raises(UnsupportedInterface):
+ ciphers.Cipher(AES(b"AAAAAAAAAAAAAAAA"), ECB, pretend_backend)