1313
1414from tests .sdk .conftest import MockDevboxView
1515from runloop_api_client .sdk import AsyncDevbox
16- from runloop_api_client ._types import NotGiven
1716from runloop_api_client .lib .polling import PollingConfig
1817from runloop_api_client .sdk .async_devbox import (
1918 _AsyncFileInterface ,
@@ -44,7 +43,7 @@ async def test_context_manager_enter_exit(self, mock_async_client: AsyncMock, de
4443 assert devbox .id == "dev_123"
4544
4645 call_kwargs = mock_async_client .devboxes .shutdown .call_args [1 ]
47- assert isinstance ( call_kwargs [ "timeout" ], NotGiven )
46+ assert "timeout" not in call_kwargs
4847
4948 @pytest .mark .asyncio
5049 async def test_context_manager_exception_handling (self , mock_async_client : AsyncMock ) -> None :
@@ -137,8 +136,7 @@ async def test_shutdown(self, mock_async_client: AsyncMock, devbox_view: MockDev
137136 @pytest .mark .asyncio
138137 async def test_suspend (self , mock_async_client : AsyncMock , devbox_view : MockDevboxView ) -> None :
139138 """Test suspend method."""
140- mock_async_client .devboxes .suspend = AsyncMock (return_value = None )
141- mock_async_client .devboxes .await_suspended = AsyncMock (return_value = devbox_view )
139+ mock_async_client .devboxes .suspend = AsyncMock (return_value = devbox_view )
142140 polling_config = PollingConfig (timeout_seconds = 60.0 )
143141
144142 devbox = AsyncDevbox (mock_async_client , "dev_123" )
@@ -154,22 +152,18 @@ async def test_suspend(self, mock_async_client: AsyncMock, devbox_view: MockDevb
154152 assert result == devbox_view
155153 mock_async_client .devboxes .suspend .assert_called_once_with (
156154 "dev_123" ,
155+ polling_config = polling_config ,
157156 extra_headers = {"X-Custom" : "value" },
158157 extra_query = {"param" : "value" },
159158 extra_body = {"key" : "value" },
160159 timeout = 30.0 ,
161160 idempotency_key = "key-123" ,
162161 )
163- mock_async_client .devboxes .await_suspended .assert_called_once_with (
164- "dev_123" ,
165- polling_config = polling_config ,
166- )
167162
168163 @pytest .mark .asyncio
169164 async def test_resume (self , mock_async_client : AsyncMock , devbox_view : MockDevboxView ) -> None :
170165 """Test resume method."""
171- mock_async_client .devboxes .resume = AsyncMock (return_value = None )
172- mock_async_client .devboxes .await_running = AsyncMock (return_value = devbox_view )
166+ mock_async_client .devboxes .resume = AsyncMock (return_value = devbox_view )
173167 polling_config = PollingConfig (timeout_seconds = 60.0 )
174168
175169 devbox = AsyncDevbox (mock_async_client , "dev_123" )
@@ -185,16 +179,13 @@ async def test_resume(self, mock_async_client: AsyncMock, devbox_view: MockDevbo
185179 assert result == devbox_view
186180 mock_async_client .devboxes .resume .assert_called_once_with (
187181 "dev_123" ,
182+ polling_config = polling_config ,
188183 extra_headers = {"X-Custom" : "value" },
189184 extra_query = {"param" : "value" },
190185 extra_body = {"key" : "value" },
191186 timeout = 30.0 ,
192187 idempotency_key = "key-123" ,
193188 )
194- mock_async_client .devboxes .await_running .assert_called_once_with (
195- "dev_123" ,
196- polling_config = polling_config ,
197- )
198189
199190 @pytest .mark .asyncio
200191 async def test_keep_alive (self , mock_async_client : AsyncMock ) -> None :
@@ -240,7 +231,17 @@ async def test_snapshot_disk(self, mock_async_client: AsyncMock) -> None:
240231
241232 assert snapshot .id == "snap_123"
242233 mock_async_client .devboxes .snapshot_disk_async .assert_called_once ()
234+ call_kwargs = mock_async_client .devboxes .snapshot_disk_async .call_args [1 ]
235+ assert "commit_message" not in call_kwargs
236+ assert call_kwargs ["metadata" ] == {"key" : "value" }
237+ assert call_kwargs ["name" ] == "test-snapshot"
238+ assert call_kwargs ["extra_headers" ] == {"X-Custom" : "value" }
239+ assert "polling_config" not in call_kwargs
240+ assert "timeout" not in call_kwargs
243241 mock_async_client .devboxes .disk_snapshots .await_completed .assert_called_once ()
242+ call_kwargs2 = mock_async_client .devboxes .disk_snapshots .await_completed .call_args [1 ]
243+ assert call_kwargs2 ["polling_config" ] == polling_config
244+ assert "timeout" not in call_kwargs2
244245
245246 @pytest .mark .asyncio
246247 async def test_snapshot_disk_async (self , mock_async_client : AsyncMock ) -> None :
@@ -257,6 +258,13 @@ async def test_snapshot_disk_async(self, mock_async_client: AsyncMock) -> None:
257258
258259 assert snapshot .id == "snap_123"
259260 mock_async_client .devboxes .snapshot_disk_async .assert_called_once ()
261+ call_kwargs = mock_async_client .devboxes .snapshot_disk_async .call_args [1 ]
262+ assert "commit_message" not in call_kwargs
263+ assert call_kwargs ["metadata" ] == {"key" : "value" }
264+ assert call_kwargs ["name" ] == "test-snapshot"
265+ assert call_kwargs ["extra_headers" ] == {"X-Custom" : "value" }
266+ assert "polling_config" not in call_kwargs
267+ assert "timeout" not in call_kwargs
260268
261269 @pytest .mark .asyncio
262270 async def test_close (self , mock_async_client : AsyncMock , devbox_view : MockDevboxView ) -> None :
@@ -267,6 +275,8 @@ async def test_close(self, mock_async_client: AsyncMock, devbox_view: MockDevbox
267275 await devbox .close ()
268276
269277 mock_async_client .devboxes .shutdown .assert_called_once ()
278+ call_kwargs = mock_async_client .devboxes .shutdown .call_args [1 ]
279+ assert "timeout" not in call_kwargs
270280
271281 def test_cmd_property (self , mock_async_client : AsyncMock ) -> None :
272282 """Test cmd property returns AsyncCommandInterface."""
0 commit comments