Skip to content

Commit

Permalink
fix(gcp): fix flaky tests from dns service (#6569)
Browse files Browse the repository at this point in the history
(cherry picked from commit f041f17)
  • Loading branch information
danibarranqueroo committed Jan 16, 2025
1 parent 6a38d22 commit 4b7bead
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from re import search
from unittest import mock

from tests.providers.gcp.gcp_fixtures import GCP_PROJECT_ID, set_mocked_gcp_provider
from tests.providers.gcp.gcp_fixtures import (
GCP_EU1_LOCATION,
GCP_PROJECT_ID,
set_mocked_gcp_provider,
)


class Test_dns_dnssec_disabled:
def test_dns_no_managed_zones(self):
dns_client = mock.MagicMock
dns_client.managed_zones = []
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down Expand Up @@ -51,6 +56,7 @@ def test_one_compliant_managed_zone(self):
dns_client = mock.MagicMock
dns_client.project_ids = [GCP_PROJECT_ID]
dns_client.managed_zones = [managed_zone]
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down Expand Up @@ -101,6 +107,7 @@ def test_managed_zone_with_dnssec_disabled(self):
dns_client = mock.MagicMock
dns_client.project_ids = [GCP_PROJECT_ID]
dns_client.managed_zones = [managed_zone]
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from re import search
from unittest import mock

from tests.providers.gcp.gcp_fixtures import GCP_PROJECT_ID, set_mocked_gcp_provider
from tests.providers.gcp.gcp_fixtures import (
GCP_EU1_LOCATION,
GCP_PROJECT_ID,
set_mocked_gcp_provider,
)


class Test_dns_rsasha1_in_use_to_key_sign_in_dnssec:
def test_dns_no_managed_zones(self):
dns_client = mock.MagicMock
dns_client.managed_zones = []
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down Expand Up @@ -51,6 +56,7 @@ def test_one_compliant_managed_zone(self):
dns_client = mock.MagicMock
dns_client.project_ids = [GCP_PROJECT_ID]
dns_client.managed_zones = [managed_zone]
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down Expand Up @@ -101,6 +107,7 @@ def test_managed_zone_with_rsasha1_key_sign(self):
dns_client = mock.MagicMock
dns_client.project_ids = [GCP_PROJECT_ID]
dns_client.managed_zones = [managed_zone]
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from re import search
from unittest import mock

from tests.providers.gcp.gcp_fixtures import GCP_PROJECT_ID, set_mocked_gcp_provider
from tests.providers.gcp.gcp_fixtures import (
GCP_EU1_LOCATION,
GCP_PROJECT_ID,
set_mocked_gcp_provider,
)


class Test_dns_rsasha1_in_use_to_zone_sign_in_dnssec:
def test_dns_no_managed_zones(self):
dns_client = mock.MagicMock
dns_client.managed_zones = []
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down Expand Up @@ -51,6 +56,7 @@ def test_one_compliant_managed_zone(self):
dns_client = mock.MagicMock
dns_client.project_ids = [GCP_PROJECT_ID]
dns_client.managed_zones = [managed_zone]
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down Expand Up @@ -101,6 +107,7 @@ def test_managed_zone_with_dnssec_disabled(self):
dns_client = mock.MagicMock
dns_client.project_ids = [GCP_PROJECT_ID]
dns_client.managed_zones = [managed_zone]
dns_client.region = GCP_EU1_LOCATION

with mock.patch(
"prowler.providers.common.provider.Provider.get_global_provider",
Expand Down

0 comments on commit 4b7bead

Please sign in to comment.