aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_utils.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-29 10:53:57 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-29 10:53:57 -0700
commit89546af52b8f8a6fc2fba520377906b4010c9037 (patch)
tree5bb161d84c93e16db187b18f5d60e651198f7185 /tests/hazmat/primitives/test_utils.py
parent3944a8ce014f9f665a2300e1fa994b872cffa92b (diff)
parenta9d9922f82d4e7b940679c4b548a4b14d0958ed9 (diff)
downloadcryptography-89546af52b8f8a6fc2fba520377906b4010c9037.tar.gz
cryptography-89546af52b8f8a6fc2fba520377906b4010c9037.tar.bz2
cryptography-89546af52b8f8a6fc2fba520377906b4010c9037.zip
Merge branch 'master' into pkcs7-padding
Diffstat (limited to 'tests/hazmat/primitives/test_utils.py')
-rw-r--r--tests/hazmat/primitives/test_utils.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_utils.py b/tests/hazmat/primitives/test_utils.py
index b7fa3d35..d7247e67 100644
--- a/tests/hazmat/primitives/test_utils.py
+++ b/tests/hazmat/primitives/test_utils.py
@@ -1,7 +1,8 @@
import pytest
from .utils import (
- base_hash_test, encrypt_test, hash_test, long_string_hash_test
+ base_hash_test, encrypt_test, hash_test, long_string_hash_test,
+ base_hmac_test, hmac_test
)
@@ -47,3 +48,25 @@ class TestLongHashTest(object):
skip_message="message!"
)
assert exc_info.value.args[0] == "message!"
+
+
+class TestHMACTest(object):
+ def test_skips_if_only_if_returns_false(self):
+ with pytest.raises(pytest.skip.Exception) as exc_info:
+ hmac_test(
+ None, None, None,
+ only_if=lambda backend: False,
+ skip_message="message!"
+ )
+ assert exc_info.value.args[0] == "message!"
+
+
+class TestBaseHMACTest(object):
+ def test_skips_if_only_if_returns_false(self):
+ with pytest.raises(pytest.skip.Exception) as exc_info:
+ base_hmac_test(
+ None, None,
+ only_if=lambda backend: False,
+ skip_message="message!"
+ )
+ assert exc_info.value.args[0] == "message!"