mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
fix(resourceexplorer2): add resource id (#2335)
Co-authored-by: Pepe Fagoaga <pepe@verica.io>
This commit is contained in:
@@ -12,6 +12,7 @@ class resourceexplorer2_indexes_found(Check):
|
||||
report.status_extended = "No Resource Explorer Indexes found"
|
||||
report.region = resource_explorer_2_client.region
|
||||
report.resource_arn = "NoResourceExplorer"
|
||||
report.resource_id = resource_explorer_2_client.audited_account
|
||||
if resource_explorer_2_client.indexes:
|
||||
report.region = resource_explorer_2_client.indexes[0].region
|
||||
report.resource_arn = resource_explorer_2_client.indexes[0].arn
|
||||
|
||||
@@ -13,6 +13,7 @@ class ResourceExplorer2:
|
||||
self.service = "resource-explorer-2"
|
||||
self.session = audit_info.audit_session
|
||||
self.audit_resources = audit_info.audit_resources
|
||||
self.audited_account = audit_info.audited_account
|
||||
self.regional_clients = generate_regional_clients(self.service, audit_info)
|
||||
# If the region is not set in the audit profile,
|
||||
# we pick the first region from the regional clients list
|
||||
|
||||
@@ -39,6 +39,7 @@ class Test_resourceexplorer2_indexes_found:
|
||||
def test_no_indexes_found(self):
|
||||
resourceexplorer2_client = mock.MagicMock
|
||||
resourceexplorer2_client.indexes = []
|
||||
resourceexplorer2_client.audited_account = AWS_ACCOUNT_NUMBER
|
||||
resourceexplorer2_client.region = AWS_REGION
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.resourceexplorer2.resourceexplorer2_service.ResourceExplorer2",
|
||||
@@ -56,7 +57,7 @@ class Test_resourceexplorer2_indexes_found:
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "FAIL"
|
||||
assert result[0].status_extended == "No Resource Explorer Indexes found"
|
||||
assert result[0].resource_id == ""
|
||||
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
|
||||
assert result[0].resource_arn == "NoResourceExplorer"
|
||||
assert result[0].region == AWS_REGION
|
||||
|
||||
@@ -65,6 +66,7 @@ class Test_resourceexplorer2_indexes_found:
|
||||
resourceexplorer2_client.indexes = [
|
||||
Indexes(arn=INDEX_ARN, region=INDEX_REGION, type="LOCAL")
|
||||
]
|
||||
resourceexplorer2_client.audited_account = AWS_ACCOUNT_NUMBER
|
||||
resourceexplorer2_client.region = AWS_REGION
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.resourceexplorer2.resourceexplorer2_service.ResourceExplorer2",
|
||||
@@ -82,6 +84,6 @@ class Test_resourceexplorer2_indexes_found:
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "PASS"
|
||||
assert result[0].status_extended == "Resource Explorer Indexes found: 1"
|
||||
assert result[0].resource_id == ""
|
||||
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
|
||||
assert result[0].resource_arn == INDEX_ARN
|
||||
assert result[0].region == AWS_REGION
|
||||
|
||||
Reference in New Issue
Block a user