23
23
from dynamodb_encryption_sdk .structures import AttributeActions , EncryptionContext
24
24
from dynamodb_encryption_sdk .transform import dict_to_ddb
25
25
26
- from ..integration_test_utils import aws_kms_cmp # noqa pylint: disable=unused-import
27
- from ..integration_test_utils import functional_test_utils , hypothesis_strategies
26
+ from ..integration_test_utils import functional_test_utils , hypothesis_strategies , set_parameterized_kms_cmps
28
27
29
28
pytestmark = pytest .mark .integ
30
29
34
33
def pytest_generate_tests (metafunc ):
35
34
functional_test_utils .set_parametrized_actions (metafunc )
36
35
functional_test_utils .set_parametrized_item (metafunc )
36
+ set_parameterized_kms_cmps (metafunc , require_attributes = False )
37
37
38
38
39
- def test_verify_user_agent (aws_kms_cmp , caplog ):
39
+ def test_verify_user_agent (all_aws_kms_cmps , caplog ):
40
40
caplog .set_level (level = logging .DEBUG )
41
41
42
- aws_kms_cmp .encryption_materials (EncryptionContext ())
42
+ all_aws_kms_cmps .encryption_materials (EncryptionContext ())
43
43
44
44
assert USER_AGENT_SUFFIX in caplog .text
45
45
@@ -54,10 +54,10 @@ def _many_items():
54
54
55
55
56
56
@pytest .mark .parametrize ("item" , _many_items ())
57
- def test_aws_kms_diverse_indexes (aws_kms_cmp , item ):
57
+ def test_aws_kms_diverse_indexes (all_aws_kms_cmps , item ):
58
58
"""Verify that AWS KMS cycle works for items with all possible combinations for primary index attribute types."""
59
59
crypto_config = CryptoConfig (
60
- materials_provider = aws_kms_cmp ,
60
+ materials_provider = all_aws_kms_cmps ,
61
61
encryption_context = EncryptionContext (
62
62
partition_key_name = "partition_key" , sort_key_name = "sort_key" , attributes = dict_to_ddb (item )
63
63
),
@@ -68,28 +68,34 @@ def test_aws_kms_diverse_indexes(aws_kms_cmp, item):
68
68
functional_test_utils .cycle_item_check (item , crypto_config )
69
69
70
70
71
- def test_aws_kms_item_cycle (aws_kms_cmp , parametrized_actions , parametrized_item ):
71
+ def test_aws_kms_item_cycle (all_aws_kms_cmps , parametrized_actions , parametrized_item ):
72
72
crypto_config = CryptoConfig (
73
- materials_provider = aws_kms_cmp , encryption_context = EncryptionContext (), attribute_actions = parametrized_actions
73
+ materials_provider = all_aws_kms_cmps ,
74
+ encryption_context = EncryptionContext (),
75
+ attribute_actions = parametrized_actions ,
74
76
)
75
77
functional_test_utils .cycle_item_check (parametrized_item , crypto_config )
76
78
77
79
78
80
@pytest .mark .slow
79
81
@hypothesis_strategies .SLOW_SETTINGS
80
82
@hypothesis .given (item = hypothesis_strategies .ddb_items )
81
- def test_aws_kms_item_cycle_hypothesis_slow (aws_kms_cmp , hypothesis_actions , item ):
83
+ def test_aws_kms_item_cycle_hypothesis_slow (all_aws_kms_cmps , hypothesis_actions , item ):
82
84
crypto_config = CryptoConfig (
83
- materials_provider = aws_kms_cmp , encryption_context = EncryptionContext (), attribute_actions = hypothesis_actions
85
+ materials_provider = all_aws_kms_cmps ,
86
+ encryption_context = EncryptionContext (),
87
+ attribute_actions = hypothesis_actions ,
84
88
)
85
89
functional_test_utils .cycle_item_check (item , crypto_config )
86
90
87
91
88
92
@pytest .mark .veryslow
89
93
@hypothesis_strategies .VERY_SLOW_SETTINGS
90
94
@hypothesis .given (item = hypothesis_strategies .ddb_items )
91
- def test_aws_kms_item_cycle_hypothesis_veryslow (aws_kms_cmp , hypothesis_actions , item ):
95
+ def test_aws_kms_item_cycle_hypothesis_veryslow (all_aws_kms_cmps , hypothesis_actions , item ):
92
96
crypto_config = CryptoConfig (
93
- materials_provider = aws_kms_cmp , encryption_context = EncryptionContext (), attribute_actions = hypothesis_actions
97
+ materials_provider = all_aws_kms_cmps ,
98
+ encryption_context = EncryptionContext (),
99
+ attribute_actions = hypothesis_actions ,
94
100
)
95
101
functional_test_utils .cycle_item_check (item , crypto_config )
0 commit comments