aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-04 19:23:17 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-04 19:23:17 -0800
commit85be46d74706a46b6407685610066506d23a49e8 (patch)
tree54717943ef76291874844175d46a125f2ce0207a /tests
parent4bdb6b54f56618a2d2cf73903b3b117436fe9fb8 (diff)
downloadcryptography-85be46d74706a46b6407685610066506d23a49e8.tar.gz
cryptography-85be46d74706a46b6407685610066506d23a49e8.tar.bz2
cryptography-85be46d74706a46b6407685610066506d23a49e8.zip
Replace assumption with some fakes
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/bindings/test_openssl.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index 3523fa4e..4e8dfa58 100644
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -11,15 +11,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import binascii
-
import pytest
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.bindings.openssl.backend import backend, Backend
from cryptography.hazmat.primitives.block import BlockCipher
-from cryptography.hazmat.primitives.block.ciphers import AES, TripleDES
-from cryptography.hazmat.primitives.block.modes import CBC, ECB
+from cryptography.hazmat.primitives.block.ciphers import AES
+from cryptography.hazmat.primitives.block.modes import CBC
+
+
+class FakeMode(object):
+ pass
+
+
+class FakeCipher(object):
+ pass
class TestOpenSSL(object):
@@ -51,12 +57,11 @@ class TestOpenSSL(object):
def test_nonexistent_cipher(self):
b = Backend()
- # TODO: this test assumes that 3DES-ECB doesn't exist
b.ciphers.register_cipher_adapter(
- TripleDES, ECB, lambda backend, cipher, mode: backend.ffi.NULL
+ FakeCipher, FakeMode, lambda backend, cipher, mode: backend.ffi.NULL
)
cipher = BlockCipher(
- TripleDES(binascii.unhexlify(b"0" * 16)), ECB(), backend=b
+ FakeCipher(), FakeMode(), backend=b,
)
with pytest.raises(UnsupportedAlgorithm):
cipher.encryptor()