Skip to content

Commit b7c4172

Browse files
committed
streamlining encrypted item tests
1 parent 75ddd51 commit b7c4172

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

test/functional/test_f_encrypted_item.py

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,61 +45,48 @@ def test_unsigned_item():
4545
exc_info.match(r'No signature attribute found in item')
4646

4747

48-
def test_ephemeral_item_cycle(some_cmps, parametrized_actions, parametrized_item):
49-
"""Test a small number of curated CMPs against a small number of curated items."""
48+
def _item_cycle_check(materials_provider, attribute_actions, item):
5049
crypto_config = CryptoConfig(
51-
materials_provider=some_cmps,
50+
materials_provider=materials_provider,
5251
encryption_context=EncryptionContext(),
53-
attribute_actions=parametrized_actions
52+
attribute_actions=attribute_actions
5453
)
55-
cycle_item_check(parametrized_item, crypto_config)
54+
cycle_item_check(item, crypto_config)
55+
56+
57+
def test_ephemeral_item_cycle(some_cmps, parametrized_actions, parametrized_item):
58+
"""Test a small number of curated CMPs against a small number of curated items."""
59+
_item_cycle_check(some_cmps, parametrized_actions, parametrized_item)
5660

5761

5862
@pytest.mark.slow
5963
def test_ephemeral_item_cycle_slow(all_the_cmps, parametrized_actions, parametrized_item):
6064
"""Test ALL THE CMPS against a small number of curated items."""
61-
crypto_config = CryptoConfig(
62-
materials_provider=all_the_cmps,
63-
encryption_context=EncryptionContext(),
64-
attribute_actions=parametrized_actions
65-
)
66-
cycle_item_check(parametrized_item, crypto_config)
65+
_item_cycle_check(all_the_cmps, parametrized_actions, parametrized_item)
6766

6867

6968
@pytest.mark.slow
69+
@pytest.mark.hypothesis
7070
@SLOW_SETTINGS
7171
@hypothesis.given(item=ddb_items)
7272
def test_ephemeral_item_cycle_hypothesis_slow(some_cmps, parametrized_actions, item):
7373
"""Test a small number of curated CMPs against a large number of items."""
74-
crypto_config = CryptoConfig(
75-
materials_provider=some_cmps,
76-
encryption_context=EncryptionContext(),
77-
attribute_actions=parametrized_actions
78-
)
79-
cycle_item_check(item, crypto_config)
74+
_item_cycle_check(some_cmps, parametrized_actions, item)
8075

8176

8277
@pytest.mark.veryslow
78+
@pytest.mark.hypothesis
8379
@VERY_SLOW_SETTINGS
8480
@hypothesis.given(item=ddb_items)
8581
def test_ephemeral_item_cycle_hypothesis_veryslow(some_cmps, parametrized_actions, item):
8682
"""Test a small number of curated CMPs against ALL THE ITEMS."""
87-
crypto_config = CryptoConfig(
88-
materials_provider=some_cmps,
89-
encryption_context=EncryptionContext(),
90-
attribute_actions=parametrized_actions
91-
)
92-
cycle_item_check(item, crypto_config)
83+
_item_cycle_check(some_cmps, parametrized_actions, item)
9384

9485

9586
@pytest.mark.nope
87+
@pytest.mark.hypothesis
9688
@VERY_SLOW_SETTINGS
9789
@hypothesis.given(item=ddb_items)
9890
def test_ephemeral_item_cycle_hypothesis_nope(all_the_cmps, parametrized_actions, item):
9991
"""Test ALL THE CMPs against ALL THE ITEMS."""
100-
crypto_config = CryptoConfig(
101-
materials_provider=all_the_cmps,
102-
encryption_context=EncryptionContext(),
103-
attribute_actions=parametrized_actions
104-
)
105-
cycle_item_check(item, crypto_config)
92+
_item_cycle_check(all_the_cmps, parametrized_actions, item)

0 commit comments

Comments
 (0)