aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_utils.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-18 21:42:57 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-18 21:43:17 -0500
commitc179407406f0ef5c2b7b5b6316521408ba3803b3 (patch)
treef2cdb7322fdf3e6bd0428644dfd54587e0ef4516 /tests/primitives/test_utils.py
parent3069921d3f1fe201f86e69bc50bf270708f2272a (diff)
downloadcryptography-c179407406f0ef5c2b7b5b6316521408ba3803b3.tar.gz
cryptography-c179407406f0ef5c2b7b5b6316521408ba3803b3.tar.bz2
cryptography-c179407406f0ef5c2b7b5b6316521408ba3803b3.zip
ripemd160 support + long string hash test
* Note that the long string hash test for RIPEMD160 adds a vector in the test. You can verify this vector (for b"a" * 1000000) on the RIPE homepage: http://homes.esat.kuleuven.be/~bosselae/ripemd160.html
Diffstat (limited to 'tests/primitives/test_utils.py')
-rw-r--r--tests/primitives/test_utils.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/primitives/test_utils.py b/tests/primitives/test_utils.py
index 43ec8a71..9888309e 100644
--- a/tests/primitives/test_utils.py
+++ b/tests/primitives/test_utils.py
@@ -1,6 +1,7 @@
import pytest
-from .utils import encrypt_test, hash_test, base_hash_test
+from .utils import (base_hash_test, encrypt_test, hash_test,
+ long_string_hash_test)
class TestEncryptTest(object):
@@ -34,3 +35,14 @@ class TestBaseHashTest(object):
skip_message="message!"
)
assert exc_info.value.args[0] == "message!"
+
+
+class TestLongHashTest(object):
+ def test_skips_if_only_if_returns_false(self):
+ with pytest.raises(pytest.skip.Exception) as exc_info:
+ long_string_hash_test(
+ None, None, None,
+ only_if=lambda api: False,
+ skip_message="message!"
+ )
+ assert exc_info.value.args[0] == "message!"