From f04317ae24441082279ea73ccca0a6630c33cc86 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sun, 27 Oct 2013 16:44:30 -0400 Subject: Move primtives into a hazmat package --- tests/hazmat/primitives/test_utils.py | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/hazmat/primitives/test_utils.py (limited to 'tests/hazmat/primitives/test_utils.py') diff --git a/tests/hazmat/primitives/test_utils.py b/tests/hazmat/primitives/test_utils.py new file mode 100644 index 00000000..b7fa3d35 --- /dev/null +++ b/tests/hazmat/primitives/test_utils.py @@ -0,0 +1,49 @@ +import pytest + +from .utils import ( + base_hash_test, encrypt_test, hash_test, long_string_hash_test +) + + +class TestEncryptTest(object): + def test_skips_if_only_if_returns_false(self): + with pytest.raises(pytest.skip.Exception) as exc_info: + encrypt_test( + None, None, None, None, + only_if=lambda backend: False, + 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 backend: 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 backend: False, + 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 backend: False, + skip_message="message!" + ) + assert exc_info.value.args[0] == "message!" -- cgit v1.2.3