aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_utils.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-18 18:08:49 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-18 18:08:49 -0500
commitbde6fb52129909cf319157dba95d65fb557d5013 (patch)
treebf8b7f02ec9560fd5446239cc0bd27ac995e3a3f /tests/primitives/test_utils.py
parent87cd0db396e157b3fb160b8b6fd770e2c661ace2 (diff)
downloadcryptography-bde6fb52129909cf319157dba95d65fb557d5013.tar.gz
cryptography-bde6fb52129909cf319157dba95d65fb557d5013.tar.bz2
cryptography-bde6fb52129909cf319157dba95d65fb557d5013.zip
Hash Saga Part 3 - API changes + SHA1 support + tests
Diffstat (limited to 'tests/primitives/test_utils.py')
-rw-r--r--tests/primitives/test_utils.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/primitives/test_utils.py b/tests/primitives/test_utils.py
index 4666ece7..43ec8a71 100644
--- a/tests/primitives/test_utils.py
+++ b/tests/primitives/test_utils.py
@@ -1,6 +1,6 @@
import pytest
-from .utils import encrypt_test
+from .utils import encrypt_test, hash_test, base_hash_test
class TestEncryptTest(object):
@@ -12,3 +12,25 @@ class TestEncryptTest(object):
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:
+ hash_test(
+ None, None, None,
+ only_if=lambda api: False,
+ skip_message="message!"
+ )
+ assert exc_info.value.args[0] == "message!"
+
+
+class TestBaseHashTest(object):
+ def test_skips_if_only_if_returns_false(self):
+ with pytest.raises(pytest.skip.Exception) as exc_info:
+ base_hash_test(
+ None, None, None, None,
+ only_if=lambda api: False,
+ skip_message="message!"
+ )
+ assert exc_info.value.args[0] == "message!"