From c179407406f0ef5c2b7b5b6316521408ba3803b3 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 18 Oct 2013 21:42:57 -0500 Subject: 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 --- tests/primitives/test_utils.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/primitives/test_utils.py') 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!" -- cgit v1.2.3