diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-12-15 23:09:13 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-12-15 23:09:13 -0800 |
commit | 5175e4e6394ade40e38dc00b8e1e14a2877aafe4 (patch) | |
tree | ce9073684c790f908044f939e92312ad82112514 /tests/hazmat/primitives/test_utils.py | |
parent | 973499aded3ce3580a8c6d44aa111288240f90a1 (diff) | |
parent | ffb7726fa3042e66e8011fbd17a8b6f83f0c8110 (diff) | |
download | cryptography-5175e4e6394ade40e38dc00b8e1e14a2877aafe4.tar.gz cryptography-5175e4e6394ade40e38dc00b8e1e14a2877aafe4.tar.bz2 cryptography-5175e4e6394ade40e38dc00b8e1e14a2877aafe4.zip |
Merge branch 'master' into validate-iv
Conflicts:
cryptography/hazmat/primitives/ciphers/modes.py
tests/hazmat/primitives/test_block.py
Diffstat (limited to 'tests/hazmat/primitives/test_utils.py')
-rw-r--r-- | tests/hazmat/primitives/test_utils.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_utils.py b/tests/hazmat/primitives/test_utils.py index cee0b20e..c39364c7 100644 --- a/tests/hazmat/primitives/test_utils.py +++ b/tests/hazmat/primitives/test_utils.py @@ -2,7 +2,8 @@ import pytest from .utils import ( base_hash_test, encrypt_test, hash_test, long_string_hash_test, - base_hmac_test, hmac_test, stream_encryption_test + base_hmac_test, hmac_test, stream_encryption_test, aead_test, + aead_exception_test, aead_tag_exception_test, ) @@ -17,6 +18,39 @@ class TestEncryptTest(object): assert exc_info.value.args[0] == "message!" +class TestAEADTest(object): + def test_skips_if_only_if_returns_false(self): + with pytest.raises(pytest.skip.Exception) as exc_info: + aead_test( + None, None, None, None, + only_if=lambda backend: False, + skip_message="message!" + ) + assert exc_info.value.args[0] == "message!" + + +class TestAEADExceptionTest(object): + def test_skips_if_only_if_returns_false(self): + with pytest.raises(pytest.skip.Exception) as exc_info: + aead_exception_test( + None, None, None, + only_if=lambda backend: False, + skip_message="message!" + ) + assert exc_info.value.args[0] == "message!" + + +class TestAEADTagExceptionTest(object): + def test_skips_if_only_if_returns_false(self): + with pytest.raises(pytest.skip.Exception) as exc_info: + aead_tag_exception_test( + None, None, None, + only_if=lambda backend: False, + skip_message="message!" + ) + assert exc_info.value.args[0] == "message!" + + class TestHashTest(object): def test_skips_if_only_if_returns_false(self): with pytest.raises(pytest.skip.Exception) as exc_info: |