@@ -80,9 +80,7 @@ def _invoke(**kwargs):
8080 "cleancloud.providers.gcp.rules.ai.workbench_idle.AuthorizedSession" ,
8181 return_value = _session (_ok ()),
8282 ):
83- return find_idle_workbench_instances (
84- project_id = _PROJECT , credentials = MagicMock (), ** kwargs
85- )
83+ return find_idle_workbench_instances (project_id = _PROJECT , credentials = MagicMock (), ** kwargs )
8684
8785
8886def _invoke_with_session (mock_session , ** kwargs ):
@@ -91,9 +89,7 @@ def _invoke_with_session(mock_session, **kwargs):
9189 "cleancloud.providers.gcp.rules.ai.workbench_idle.AuthorizedSession" ,
9290 return_value = mock_session ,
9391 ):
94- return find_idle_workbench_instances (
95- project_id = _PROJECT , credentials = MagicMock (), ** kwargs
96- )
92+ return find_idle_workbench_instances (project_id = _PROJECT , credentials = MagicMock (), ** kwargs )
9793
9894
9995# ---------------------------------------------------------------------------
@@ -110,13 +106,19 @@ def test_always_empty(self):
110106
111107 def test_empty_when_api_returns_active_instances (self ):
112108 """EMITTING_DISABLED: ACTIVE instances in API response still yield no findings."""
113- inst = {"name" : f"projects/{ _PROJECT } /locations/us-central1/instances/wb-1" , "state" : "ACTIVE" }
109+ inst = {
110+ "name" : f"projects/{ _PROJECT } /locations/us-central1/instances/wb-1" ,
111+ "state" : "ACTIVE" ,
112+ }
114113 result = _invoke_with_session (_session (_ok ({"instances" : [inst ]})))
115114 assert result == []
116115
117116 def test_empty_when_api_returns_multiple_instances (self ):
118117 instances = [
119- {"name" : f"projects/{ _PROJECT } /locations/us-central1/instances/wb-{ i } " , "state" : "ACTIVE" }
118+ {
119+ "name" : f"projects/{ _PROJECT } /locations/us-central1/instances/wb-{ i } " ,
120+ "state" : "ACTIVE" ,
121+ }
120122 for i in range (5 )
121123 ]
122124 result = _invoke_with_session (_session (_ok ({"instances" : instances })))
@@ -131,9 +133,7 @@ def test_empty_when_api_returns_multiple_instances(self):
131133class TestIdleDaysValidation :
132134 def test_zero_raises_value_error (self ):
133135 with pytest .raises (ValueError , match = "idle_days must be >= 1" ):
134- find_idle_workbench_instances (
135- project_id = _PROJECT , credentials = MagicMock (), idle_days = 0
136- )
136+ find_idle_workbench_instances (project_id = _PROJECT , credentials = MagicMock (), idle_days = 0 )
137137
138138 def test_negative_one_raises (self ):
139139 with pytest .raises (ValueError , match = "idle_days must be >= 1" ):
@@ -352,6 +352,7 @@ def test_two_pages_accumulates_instances(self):
352352 def test_three_pages_all_accumulated (self ):
353353 def _inst (i ):
354354 return {"name" : f"projects/p/locations/us-central1/instances/i{ i } " , "state" : "ACTIVE" }
355+
355356 session = _session (
356357 _ok ({"instances" : [_inst (1 )], "nextPageToken" : "t1" }),
357358 _ok ({"instances" : [_inst (2 )], "nextPageToken" : "t2" }),
0 commit comments