diff --git a/tests/providers/aws/services/dms/dms_endpoint_ssl_enabled_test/dms_endpoint_ssl_enabled_test.py b/tests/providers/aws/services/dms/dms_endpoint_ssl_enabled_test/dms_endpoint_ssl_enabled_test.py index 23df60283a1..f9cd64921cc 100644 --- a/tests/providers/aws/services/dms/dms_endpoint_ssl_enabled_test/dms_endpoint_ssl_enabled_test.py +++ b/tests/providers/aws/services/dms/dms_endpoint_ssl_enabled_test/dms_endpoint_ssl_enabled_test.py @@ -12,6 +12,9 @@ def test_dms_no_endpoints(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_endpoint_ssl_enabled.dms_endpoint_ssl_enabled import ( dms_endpoint_ssl_enabled, @@ -41,6 +44,9 @@ def test_dms_endpoint_ssl_none(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_endpoint_ssl_enabled.dms_endpoint_ssl_enabled import ( dms_endpoint_ssl_enabled, @@ -85,6 +91,9 @@ def test_dms_endpoint_ssl_require(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_endpoint_ssl_enabled.dms_endpoint_ssl_enabled import ( dms_endpoint_ssl_enabled, @@ -126,6 +135,9 @@ def test_dms_endpoint_ssl_verify_ca(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_endpoint_ssl_enabled.dms_endpoint_ssl_enabled import ( dms_endpoint_ssl_enabled, @@ -167,6 +179,9 @@ def test_dms_endpoint_ssl_verify_full(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_endpoint_ssl_enabled.dms_endpoint_ssl_enabled import ( dms_endpoint_ssl_enabled, diff --git a/tests/providers/aws/services/dms/dms_instance_minor_version_upgrade_enabled/dms_instance_minor_version_upgrade_enabled_test.py b/tests/providers/aws/services/dms/dms_instance_minor_version_upgrade_enabled/dms_instance_minor_version_upgrade_enabled_test.py index 1022a54bbd9..b5a9c987165 100644 --- a/tests/providers/aws/services/dms/dms_instance_minor_version_upgrade_enabled/dms_instance_minor_version_upgrade_enabled_test.py +++ b/tests/providers/aws/services/dms/dms_instance_minor_version_upgrade_enabled/dms_instance_minor_version_upgrade_enabled_test.py @@ -18,6 +18,9 @@ def test_dms_no_instances(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_minor_version_upgrade_enabled.dms_instance_minor_version_upgrade_enabled import ( dms_instance_minor_version_upgrade_enabled, @@ -47,6 +50,9 @@ def test_dms_minor_version_upgrade_not_enabled(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_minor_version_upgrade_enabled.dms_instance_minor_version_upgrade_enabled import ( dms_instance_minor_version_upgrade_enabled, @@ -87,6 +93,9 @@ def test_dms_instance_minor_version_upgrade_enabled(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_minor_version_upgrade_enabled.dms_instance_minor_version_upgrade_enabled import ( dms_instance_minor_version_upgrade_enabled, diff --git a/tests/providers/aws/services/dms/dms_instance_multi_az/dms_instance_multi_az_test.py b/tests/providers/aws/services/dms/dms_instance_multi_az/dms_instance_multi_az_test.py index 3ba0c3befcb..86ce420427d 100644 --- a/tests/providers/aws/services/dms/dms_instance_multi_az/dms_instance_multi_az_test.py +++ b/tests/providers/aws/services/dms/dms_instance_multi_az/dms_instance_multi_az_test.py @@ -18,6 +18,9 @@ def test_dms_no_instances(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_multi_az_enabled.dms_instance_multi_az_enabled import ( dms_instance_multi_az_enabled, @@ -47,6 +50,9 @@ def test_dms_instance_multi_az_not_enabled(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_multi_az_enabled.dms_instance_multi_az_enabled import ( dms_instance_multi_az_enabled, @@ -87,6 +93,9 @@ def test_dms_instance_multi_az_enabled(self): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_multi_az_enabled.dms_instance_multi_az_enabled import ( dms_instance_multi_az_enabled, diff --git a/tests/providers/aws/services/dms/dms_instance_no_public_access/dms_no_public_access_test.py b/tests/providers/aws/services/dms/dms_instance_no_public_access/dms_no_public_access_test.py index 82e54bbda34..83d3fd91725 100644 --- a/tests/providers/aws/services/dms/dms_instance_no_public_access/dms_no_public_access_test.py +++ b/tests/providers/aws/services/dms/dms_instance_no_public_access/dms_no_public_access_test.py @@ -19,23 +19,19 @@ class Test_dms_instance_no_public_access: def test_dms_no_instances(self): - dms_client = mock.MagicMock + dms_client = mock.MagicMock() dms_client.instances = [] - from prowler.providers.aws.services.ec2.ec2_service import EC2 - - aws_provider = set_mocked_aws_provider([AWS_REGION_US_EAST_1]) - with mock.patch( "prowler.providers.common.provider.Provider.get_global_provider", - return_value=aws_provider, + return_value=set_mocked_aws_provider([AWS_REGION_US_EAST_1]), ): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, ), mock.patch( - "prowler.providers.aws.services.rds.rds_instance_no_public_access.rds_instance_no_public_access.ec2_client", - new=EC2(aws_provider), + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access import ( dms_instance_no_public_access, @@ -46,7 +42,7 @@ def test_dms_no_instances(self): assert len(result) == 0 def test_dms_private(self): - dms_client = mock.MagicMock + dms_client = mock.MagicMock() dms_client.instances = [] dms_client.instances.append( RepInstance( @@ -63,15 +59,16 @@ def test_dms_private(self): ) ) - aws_provider = set_mocked_aws_provider([AWS_REGION_US_EAST_1]) - with mock.patch( "prowler.providers.common.provider.Provider.get_global_provider", - return_value=aws_provider, + return_value=set_mocked_aws_provider([AWS_REGION_US_EAST_1]), ): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access import ( dms_instance_no_public_access, @@ -96,7 +93,7 @@ def test_dms_private(self): ] def test_dms_public(self): - dms_client = mock.MagicMock + dms_client = mock.MagicMock() dms_client.instances = [] dms_client.instances.append( RepInstance( @@ -113,15 +110,16 @@ def test_dms_public(self): ) ) - aws_provider = set_mocked_aws_provider([AWS_REGION_US_EAST_1]) - with mock.patch( "prowler.providers.common.provider.Provider.get_global_provider", - return_value=aws_provider, + return_value=set_mocked_aws_provider([AWS_REGION_US_EAST_1]), ): with mock.patch( "prowler.providers.aws.services.dms.dms_service.DMS", new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", + new=dms_client, ): from prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access import ( dms_instance_no_public_access, @@ -162,7 +160,7 @@ def test_dms_public_with_public_sg(self): } ], ) - dms_client = mock.MagicMock + dms_client = mock.MagicMock() dms_client.instances = [] dms_client.instances.append( RepInstance( @@ -191,7 +189,10 @@ def test_dms_public_with_public_sg(self): return_value=aws_provider, ): with mock.patch( - "prowler.providers.aws.services.dms.dms_service.DMS", + "prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access.dms_client", + new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", new=dms_client, ), mock.patch( "prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access.ec2_client", @@ -267,7 +268,10 @@ def test_dms_public_with_filtered_sg(self): return_value=aws_provider, ): with mock.patch( - "prowler.providers.aws.services.dms.dms_service.DMS", + "prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access.dms_client", + new=dms_client, + ), mock.patch( + "prowler.providers.aws.services.dms.dms_client.dms_client", new=dms_client, ), mock.patch( "prowler.providers.aws.services.dms.dms_instance_no_public_access.dms_instance_no_public_access.ec2_client",