diff options
| author | Julian Krause <julian.krause@gmail.com> | 2013-12-25 12:58:40 -0800 | 
|---|---|---|
| committer | Julian Krause <julian.krause@gmail.com> | 2013-12-25 12:58:40 -0800 | 
| commit | e62760af74ebb8b08d7670dfaff177cdeb679f0f (patch) | |
| tree | 70e51d6aadff7d1ec204793b12de221610204254 /tests/hazmat/primitives/test_block.py | |
| parent | c91fe6a21fbae3107de7b2e53b7343cd67ac8c6d (diff) | |
| parent | 0865a8b81075bfe073aba56e03cc57c30bfffe00 (diff) | |
| download | cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.tar.gz cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.tar.bz2 cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.zip | |
Merge branch 'master' of https://github.com/pyca/cryptography into verify
Conflicts:
	tests/hazmat/primitives/test_hashes.py
	tests/hazmat/primitives/test_hmac.py
Diffstat (limited to 'tests/hazmat/primitives/test_block.py')
| -rw-r--r-- | tests/hazmat/primitives/test_block.py | 15 | 
1 files changed, 12 insertions, 3 deletions
| diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py index 02de3861..22a7c02f 100644 --- a/tests/hazmat/primitives/test_block.py +++ b/tests/hazmat/primitives/test_block.py @@ -31,11 +31,17 @@ from .utils import (  ) +@utils.register_interface(interfaces.Mode) +class DummyMode(object): +    name = "dummy-mode" + +  @utils.register_interface(interfaces.CipherAlgorithm)  class DummyCipher(object): -    pass +    name = "dummy-cipher" +@pytest.mark.cipher  class TestCipher(object):      def test_creates_encryptor(self, backend):          cipher = Cipher( @@ -59,6 +65,7 @@ class TestCipher(object):              Cipher(algorithm, mode=None, backend=backend) +@pytest.mark.cipher  class TestCipherContext(object):      def test_use_after_finalize(self, backend):          cipher = Cipher( @@ -101,9 +108,10 @@ class TestCipherContext(object):          assert pt == b"a" * 80          decryptor.finalize() -    def test_nonexistent_cipher(self, backend): +    @pytest.mark.parametrize("mode", [DummyMode(), None]) +    def test_nonexistent_cipher(self, backend, mode):          cipher = Cipher( -            DummyCipher(), object(), backend +            DummyCipher(), mode, backend          )          with pytest.raises(UnsupportedAlgorithm):              cipher.encryptor() @@ -128,6 +136,7 @@ class TestCipherContext(object):              decryptor.finalize() +@pytest.mark.cipher  class TestAEADCipherContext(object):      test_aead_exceptions = generate_aead_exception_test(          algorithms.AES, | 
