Skip to content

Commit f8f7d9a

Browse files
committed
Update test mocking.
1 parent 3db64ea commit f8f7d9a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_api.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setUp(self):
2222
)
2323
self.env_patcher.start()
2424

25-
@patch("boto3.client")
25+
@patch("botocore.session.Session.create_client")
2626
def test_secrets_manager_fips_endpoint(self, mock_boto3_client):
2727
mock_client = MagicMock()
2828
mock_client.get_secret_value.return_value = {"SecretString": "test-api-key"}
@@ -42,7 +42,7 @@ def test_secrets_manager_fips_endpoint(self, mock_boto3_client):
4242
)
4343
self.assertEqual(api_key, "test-api-key")
4444

45-
@patch("boto3.client")
45+
@patch("botocore.session.Session.create_client")
4646
def test_secrets_manager_different_region(self, mock_boto3_client):
4747
mock_client = MagicMock()
4848
mock_client.get_secret_value.return_value = {"SecretString": "test-api-key"}
@@ -62,7 +62,7 @@ def test_secrets_manager_different_region(self, mock_boto3_client):
6262
)
6363
self.assertEqual(api_key, "test-api-key")
6464

65-
@patch("boto3.client")
65+
@patch("botocore.session.Session.create_client")
6666
def test_ssm_fips_endpoint(self, mock_boto3_client):
6767
mock_client = MagicMock()
6868
mock_client.get_parameter.return_value = {
@@ -80,7 +80,7 @@ def test_ssm_fips_endpoint(self, mock_boto3_client):
8080
)
8181
self.assertEqual(api_key, "test-api-key")
8282

83-
@patch("boto3.client")
83+
@patch("botocore.session.Session.create_client")
8484
@patch("datadog_lambda.api.decrypt_kms_api_key")
8585
def test_kms_fips_endpoint(self, mock_decrypt_kms, mock_boto3_client):
8686
mock_client = MagicMock()
@@ -97,7 +97,7 @@ def test_kms_fips_endpoint(self, mock_decrypt_kms, mock_boto3_client):
9797
)
9898
self.assertEqual(api_key, "test-api-key")
9999

100-
@patch("boto3.client")
100+
@patch("botocore.session.Session.create_client")
101101
def test_no_fips_for_standard_regions(self, mock_boto3_client):
102102
mock_client = MagicMock()
103103
mock_client.get_secret_value.return_value = {"SecretString": "test-api-key"}

0 commit comments

Comments
 (0)