aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_utils.py
blob: 43ec8a71059e11335f595c8d82f46c6f94279cb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest

from .utils import encrypt_test, hash_test, base_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 api: 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 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!"