From 4460bc2e825bfc8ffd4c3002cf24754349c9c335 Mon Sep 17 00:00:00 2001 From: Pepe Fagoaga Date: Thu, 30 Jan 2025 11:45:53 +0100 Subject: [PATCH] test(azure): subscription is None by default --- prowler/lib/check/models.py | 4 +--- tests/lib/check/models_test.py | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/prowler/lib/check/models.py b/prowler/lib/check/models.py index 3295382646..d4db7e0a4e 100644 --- a/prowler/lib/check/models.py +++ b/prowler/lib/check/models.py @@ -475,7 +475,7 @@ class Check_Report_Azure(CheckReport): resource_name: str resource_id: str - subscription: str + subscription: str = None location: str def __init__(self, metadata: Dict, resource: Any) -> None: @@ -496,8 +496,6 @@ class Check_Report_Azure(CheckReport): except AttributeError: self.resource_name = getattr(resource, "resource_name") - # TODO: review self.subscription - self.subscription = "" self.location = getattr(resource, "location", "global") diff --git a/tests/lib/check/models_test.py b/tests/lib/check/models_test.py index 059d495ed6..bfba438b08 100644 --- a/tests/lib/check/models_test.py +++ b/tests/lib/check/models_test.py @@ -424,6 +424,7 @@ class TestCheckReportAzure: assert report.resource_id == "test_id" assert report.resource_name == "test_name" assert report.location == "test_location" + assert report.subscription is None def test_check_report_azure_no_id(self): resource = mock.Mock @@ -442,6 +443,7 @@ class TestCheckReportAzure: assert report.resource_id == "test_id" assert report.resource_name == "test_name" assert report.location == "global" + assert report.subscription is None def test_check_report_azure_no_name(self): resource = mock.Mock @@ -460,6 +462,7 @@ class TestCheckReportAzure: assert report.resource_id == "test_id" assert report.resource_name == "test_name" assert report.location == "global" + assert report.subscription is None def test_check_report_azure_no_location(self): resource = mock.Mock @@ -469,3 +472,4 @@ class TestCheckReportAzure: assert report.resource_id == "test_id" assert report.resource_name == "test_name" assert report.location == "global" + assert report.subscription is None