aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_utils.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-28 17:34:27 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-28 17:34:27 -0500
commit0317b04b119ceb55e11cf1be28c5223bad240c26 (patch)
tree7ddf3ce8f7e7f51cdca419e915e60a853d678fed /tests/hazmat/primitives/test_utils.py
parent0a0d749e38d849c6d4b1767b6a3994408f0977f1 (diff)
downloadcryptography-0317b04b119ceb55e11cf1be28c5223bad240c26.tar.gz
cryptography-0317b04b119ceb55e11cf1be28c5223bad240c26.tar.bz2
cryptography-0317b04b119ceb55e11cf1be28c5223bad240c26.zip
HMAC support
Conflicts: docs/primitives/index.rst tests/hazmat/primitives/utils.py
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!"