mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
fix(fms): resource metadata could not be converted to dict (#7388)
Co-authored-by: Daniel Barranquero <74871504+danibarranqueroo@users.noreply.github.com>
This commit is contained in:
@@ -6,9 +6,7 @@ class fms_policy_compliant(Check):
|
||||
def execute(self):
|
||||
findings = []
|
||||
if fms_client.fms_admin_account:
|
||||
report = Check_Report_AWS(
|
||||
metadata=self.metadata(), resource=fms_client.fms_policies
|
||||
)
|
||||
report = Check_Report_AWS(metadata=self.metadata(), resource={})
|
||||
report.region = fms_client.region
|
||||
report.resource_arn = fms_client.policy_arn_template
|
||||
report.resource_id = fms_client.audited_account
|
||||
|
||||
@@ -97,6 +97,7 @@ class Test_fms_policy_compliant:
|
||||
== f"arn:aws:fms:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:policy"
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource == fms_client.fms_policies[0]
|
||||
|
||||
def test_fms_admin_with_compliant_policies(self):
|
||||
fms_client = mock.MagicMock
|
||||
@@ -150,6 +151,7 @@ class Test_fms_policy_compliant:
|
||||
== f"arn:aws:fms:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:policy"
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource == {}
|
||||
|
||||
def test_fms_admin_with_non_and_compliant_policies(self):
|
||||
fms_client = mock.MagicMock
|
||||
@@ -209,6 +211,7 @@ class Test_fms_policy_compliant:
|
||||
== f"arn:aws:fms:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:policy"
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource == fms_client.fms_policies[0]
|
||||
|
||||
def test_fms_admin_without_policies(self):
|
||||
fms_client = mock.MagicMock
|
||||
@@ -246,6 +249,7 @@ class Test_fms_policy_compliant:
|
||||
== f"arn:aws:fms:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:policy"
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource == {}
|
||||
|
||||
def test_fms_admin_with_policy_with_null_status(self):
|
||||
fms_client = mock.MagicMock
|
||||
@@ -297,3 +301,4 @@ class Test_fms_policy_compliant:
|
||||
assert result[0].resource_id == "12345678901"
|
||||
assert result[0].resource_arn == "arn:aws:fms:us-east-1:12345678901"
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource == fms_client.fms_policies[0]
|
||||
|
||||
Reference in New Issue
Block a user