From 814efab2a71a869d362c0b488b6c51bb590f0d23 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 3 Oct 2013 09:24:58 -0700 Subject: Explicitly pass around the API, and run all tests under all available APIs --- tests/primitives/test_block.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'tests/primitives/test_block.py') diff --git a/tests/primitives/test_block.py b/tests/primitives/test_block.py index 774409ca..92fd31a3 100644 --- a/tests/primitives/test_block.py +++ b/tests/primitives/test_block.py @@ -23,17 +23,19 @@ from cryptography.primitives.block.base import _Operation class TestBlockCipher(object): - def test_cipher_name(self): + def test_cipher_name(self, api): cipher = BlockCipher( ciphers.AES(binascii.unhexlify(b"0" * 32)), - modes.CBC(binascii.unhexlify(b"0" * 32)) + modes.CBC(binascii.unhexlify(b"0" * 32)), + api ) assert cipher.name == "AES-128-CBC" - def test_use_after_finalize(self): + def test_use_after_finalize(self, api): cipher = BlockCipher( ciphers.AES(binascii.unhexlify(b"0" * 32)), - modes.CBC(binascii.unhexlify(b"0" * 32)) + modes.CBC(binascii.unhexlify(b"0" * 32)), + api ) cipher.encrypt(b"a" * 16) cipher.finalize() @@ -42,20 +44,22 @@ class TestBlockCipher(object): with pytest.raises(ValueError): cipher.finalize() - def test_encrypt_with_invalid_operation(self): + def test_encrypt_with_invalid_operation(self, api): cipher = BlockCipher( ciphers.AES(binascii.unhexlify(b"0" * 32)), - modes.CBC(binascii.unhexlify(b"0" * 32)) + modes.CBC(binascii.unhexlify(b"0" * 32)), + api ) cipher._operation = _Operation.decrypt with pytest.raises(ValueError): cipher.encrypt(b"b" * 16) - def test_finalize_with_invalid_operation(self): + def test_finalize_with_invalid_operation(self, api): cipher = BlockCipher( ciphers.AES(binascii.unhexlify(b"0" * 32)), - modes.CBC(binascii.unhexlify(b"0" * 32)) + modes.CBC(binascii.unhexlify(b"0" * 32)), + api ) cipher._operation = pretend.stub(name="wat") -- cgit v1.2.3