File tree Expand file tree Collapse file tree
src/secops/chronicle/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def format_resource_id(resource_id: str) -> str:
3636 The extracted ID from the resource string, or the original string if it doesn't match the expected format.
3737 """
3838 if resource_id .startswith ("projects/" ):
39- return resource_id .split ("projects /" )[- 1 ]
39+ return resource_id .split ("/" )[- 1 ]
4040 return resource_id
4141
4242
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ def test_format_resource_id_returns_bare_id_unchanged() -> None:
2727
2828
2929def test_format_resource_id_extracts_id_from_full_resource_name () -> None :
30- # Full resource name should have everything up to and including "projects/" stripped
30+ # Full resource name should have the ID extracted correctly
3131 full_name = "projects/12345/locations/eu/instances/my-instance/nativeDashboards/123-ID-abc"
32- assert format_resource_id (full_name ) == "12345/locations/eu/instances/my-instance/nativeDashboards/ 123-ID-abc"
32+ assert format_resource_id (full_name ) == "123-ID-abc"
3333
3434
3535def test_format_resource_id_handles_minimal_projects_prefix () -> None :
You can’t perform that action at this time.
0 commit comments