11
11
# ANY KIND, either express or implied. See the License for the specific
12
12
# language governing permissions and limitations under the License.
13
13
"""Unit test suite from aws_encryption_sdk.key_providers.kms.KMSMasterKeyProvider"""
14
- import unittest
15
-
16
14
import botocore .client
17
15
import pytest
18
16
import six
@@ -32,8 +30,9 @@ def test_init_with_regionless_key_ids_and_region_names():
32
30
assert provider .master_key ("alias/key_1" ).config .client .meta .region_name == region_names [0 ]
33
31
34
32
35
- class TestKMSMasterKeyProvider (unittest .TestCase ):
36
- def setUp (self ):
33
+ class TestKMSMasterKeyProvider (object ):
34
+ @pytest .fixture (autouse = True )
35
+ def apply_fixtures (self ):
37
36
self .mock_botocore_session_patcher = patch ("aws_encryption_sdk.key_providers.kms.botocore.session.Session" )
38
37
self .mock_botocore_session = self .mock_botocore_session_patcher .start ()
39
38
self .mock_boto3_session_patcher = patch ("aws_encryption_sdk.key_providers.kms.boto3.session.Session" )
@@ -130,10 +129,9 @@ def test_client_no_region_name_with_default(self, mock_add_client):
130
129
131
130
def test_client_no_region_name_without_default (self ):
132
131
test = KMSMasterKeyProvider ()
133
- with six .assertRaisesRegex (
134
- self , UnknownRegionError , "No default region found and no region determinable from key id: *"
135
- ):
132
+ with pytest .raises (UnknownRegionError ) as excinfo :
136
133
test ._client ("" )
134
+ excinfo .match ("No default region found and no region determinable from key id: *" )
137
135
138
136
@patch ("aws_encryption_sdk.key_providers.kms.KMSMasterKeyProvider._client" )
139
137
def test_new_master_key (self , mock_client ):
0 commit comments