Skip to content

Commit 35fc246

Browse files
committed
Refactor the test file to resolve the python version error
1 parent 2618054 commit 35fc246

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

securitycenter/snippets_management_api/security_health_analytics_custom_modules_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def test_get_security_health_analytics_custom_module():
218218

219219
assert response is not None, "Failed to retrieve the custom module."
220220
assert response.display_name.startswith(PREFIX)
221-
assert response.enablement_state == securitycentermanagement_v1.SecurityHealthAnalyticsCustomModule.EnablementState.ENABLED
221+
response_org_id = response.name.split("/")[1] # Extract organization ID from the name field
222+
assert response_org_id == ORGANIZATION_ID, f"Organization ID mismatch: Expected {ORGANIZATION_ID}, got {response_org_id}."
222223

223224

224225
@backoff.on_exception(
@@ -255,6 +256,7 @@ def test_list_security_health_analytics_custom_module():
255256
backoff.expo, (InternalServerError, ServiceUnavailable, NotFound), max_tries=3
256257
)
257258
def test_update_security_health_analytics_custom_module():
259+
258260
parent = f"organizations/{ORGANIZATION_ID}/locations/{LOCATION}"
259261
response = security_health_analytics_custom_modules.create_security_health_analytics_custom_module(parent)
260262
module_id = extract_custom_module_id(response.name)
@@ -283,7 +285,8 @@ def test_get_effective_security_health_analytics_custom_module():
283285
assert response is not None, "Failed to retrieve the custom module."
284286
# Verify that the custom module was created
285287
assert response.display_name.startswith(PREFIX)
286-
assert response.enablement_state == securitycentermanagement_v1.EffectiveSecurityHealthAnalyticsCustomModule.EnablementState.ENABLED
288+
response_org_id = response.name.split("/")[1] # Extract organization ID from the name field
289+
assert response_org_id == ORGANIZATION_ID, f"Organization ID mismatch: Expected {ORGANIZATION_ID}, got {response_org_id}."
287290

288291

289292
@backoff.on_exception(

0 commit comments

Comments
 (0)