Skip to content

Commit 92b6130

Browse files
committed
fix assert_called to assert_awaited
1 parent bf11fd2 commit 92b6130

6 files changed

Lines changed: 36 additions & 36 deletions

tests/sdk/test_async_blueprint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def test_get_info(self, mock_async_client: AsyncMock, blueprint_view: Mock
3838
)
3939

4040
assert result == blueprint_view
41-
mock_async_client.blueprints.retrieve.assert_called_once()
41+
mock_async_client.blueprints.retrieve.assert_awaited_once()
4242

4343
@pytest.mark.asyncio
4444
async def test_logs(self, mock_async_client: AsyncMock) -> None:
@@ -55,7 +55,7 @@ async def test_logs(self, mock_async_client: AsyncMock) -> None:
5555
)
5656

5757
assert result == logs_view
58-
mock_async_client.blueprints.logs.assert_called_once()
58+
mock_async_client.blueprints.logs.assert_awaited_once()
5959

6060
@pytest.mark.asyncio
6161
async def test_delete(self, mock_async_client: AsyncMock) -> None:
@@ -71,7 +71,7 @@ async def test_delete(self, mock_async_client: AsyncMock) -> None:
7171
)
7272

7373
assert result is not None # Verify return value is propagated
74-
mock_async_client.blueprints.delete.assert_called_once()
74+
mock_async_client.blueprints.delete.assert_awaited_once()
7575

7676
@pytest.mark.asyncio
7777
async def test_create_devbox(self, mock_async_client: AsyncMock, devbox_view: MockDevboxView) -> None:
@@ -87,4 +87,4 @@ async def test_create_devbox(self, mock_async_client: AsyncMock, devbox_view: Mo
8787
)
8888

8989
assert devbox.id == "dev_123"
90-
mock_async_client.devboxes.create_and_await_running.assert_called_once()
90+
mock_async_client.devboxes.create_and_await_running.assert_awaited_once()

tests/sdk/test_async_execution_result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ async def mock_iter():
190190
# Should stream full output
191191
output = await result.stdout()
192192
assert output == "line1\nline2\nline3\n"
193-
mock_async_client.devboxes.executions.stream_stdout_updates.assert_called_once_with(
193+
mock_async_client.devboxes.executions.stream_stdout_updates.assert_awaited_once_with(
194194
"exec_123", devbox_id="dev_123"
195195
)
196196

@@ -226,7 +226,7 @@ async def mock_iter():
226226
# Should stream full output
227227
output = await result.stderr()
228228
assert output == "error1\nerror2\n"
229-
mock_async_client.devboxes.executions.stream_stderr_updates.assert_called_once_with(
229+
mock_async_client.devboxes.executions.stream_stderr_updates.assert_awaited_once_with(
230230
"exec_123", devbox_id="dev_123"
231231
)
232232

tests/sdk/test_async_ops.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def test_create(self, mock_async_client: AsyncMock, devbox_view: MockDevbo
4747

4848
assert isinstance(devbox, AsyncDevbox)
4949
assert devbox.id == "dev_123"
50-
mock_async_client.devboxes.create_and_await_running.assert_called_once()
50+
mock_async_client.devboxes.create_and_await_running.assert_awaited_once()
5151

5252
@pytest.mark.asyncio
5353
async def test_create_from_blueprint_id(self, mock_async_client: AsyncMock, devbox_view: MockDevboxView) -> None:
@@ -115,7 +115,7 @@ async def test_list_empty(self, mock_async_client: AsyncMock) -> None:
115115
devboxes = await ops.list(limit=10, status="running")
116116

117117
assert len(devboxes) == 0
118-
mock_async_client.devboxes.list.assert_called_once()
118+
mock_async_client.devboxes.list.assert_awaited_once()
119119

120120
@pytest.mark.asyncio
121121
async def test_list_single(self, mock_async_client: AsyncMock, devbox_view: MockDevboxView) -> None:
@@ -133,7 +133,7 @@ async def test_list_single(self, mock_async_client: AsyncMock, devbox_view: Mock
133133
assert len(devboxes) == 1
134134
assert isinstance(devboxes[0], AsyncDevbox)
135135
assert devboxes[0].id == "dev_123"
136-
mock_async_client.devboxes.list.assert_called_once()
136+
mock_async_client.devboxes.list.assert_awaited_once()
137137

138138
@pytest.mark.asyncio
139139
async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
@@ -151,7 +151,7 @@ async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
151151
assert isinstance(devboxes[1], AsyncDevbox)
152152
assert devboxes[0].id == "dev_001"
153153
assert devboxes[1].id == "dev_002"
154-
mock_async_client.devboxes.list.assert_called_once()
154+
mock_async_client.devboxes.list.assert_awaited_once()
155155

156156

157157
class TestAsyncSnapshotOps:
@@ -167,7 +167,7 @@ async def test_list_empty(self, mock_async_client: AsyncMock) -> None:
167167
snapshots = await ops.list(devbox_id="dev_123", limit=10)
168168

169169
assert len(snapshots) == 0
170-
mock_async_client.devboxes.disk_snapshots.list.assert_called_once()
170+
mock_async_client.devboxes.disk_snapshots.list.assert_awaited_once()
171171

172172
@pytest.mark.asyncio
173173
async def test_list_single(self, mock_async_client: AsyncMock, snapshot_view: MockSnapshotView) -> None:
@@ -185,7 +185,7 @@ async def test_list_single(self, mock_async_client: AsyncMock, snapshot_view: Mo
185185
assert len(snapshots) == 1
186186
assert isinstance(snapshots[0], AsyncSnapshot)
187187
assert snapshots[0].id == "snap_123"
188-
mock_async_client.devboxes.disk_snapshots.list.assert_called_once()
188+
mock_async_client.devboxes.disk_snapshots.list.assert_awaited_once()
189189

190190
@pytest.mark.asyncio
191191
async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
@@ -203,7 +203,7 @@ async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
203203
assert isinstance(snapshots[1], AsyncSnapshot)
204204
assert snapshots[0].id == "snap_001"
205205
assert snapshots[1].id == "snap_002"
206-
mock_async_client.devboxes.disk_snapshots.list.assert_called_once()
206+
mock_async_client.devboxes.disk_snapshots.list.assert_awaited_once()
207207

208208
def test_from_id(self, mock_async_client: AsyncMock) -> None:
209209
"""Test from_id method."""
@@ -230,7 +230,7 @@ async def test_create(self, mock_async_client: AsyncMock, blueprint_view: MockBl
230230

231231
assert isinstance(blueprint, AsyncBlueprint)
232232
assert blueprint.id == "bp_123"
233-
mock_async_client.blueprints.create_and_await_build_complete.assert_called_once()
233+
mock_async_client.blueprints.create_and_await_build_complete.assert_awaited_once()
234234

235235
def test_from_id(self, mock_async_client: AsyncMock) -> None:
236236
"""Test from_id method."""
@@ -250,7 +250,7 @@ async def test_list_empty(self, mock_async_client: AsyncMock) -> None:
250250
blueprints = await ops.list(limit=10)
251251

252252
assert len(blueprints) == 0
253-
mock_async_client.blueprints.list.assert_called_once()
253+
mock_async_client.blueprints.list.assert_awaited_once()
254254

255255
@pytest.mark.asyncio
256256
async def test_list_single(self, mock_async_client: AsyncMock, blueprint_view: MockBlueprintView) -> None:
@@ -268,7 +268,7 @@ async def test_list_single(self, mock_async_client: AsyncMock, blueprint_view: M
268268
assert len(blueprints) == 1
269269
assert isinstance(blueprints[0], AsyncBlueprint)
270270
assert blueprints[0].id == "bp_123"
271-
mock_async_client.blueprints.list.assert_called_once()
271+
mock_async_client.blueprints.list.assert_awaited_once()
272272

273273
@pytest.mark.asyncio
274274
async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
@@ -286,7 +286,7 @@ async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
286286
assert isinstance(blueprints[1], AsyncBlueprint)
287287
assert blueprints[0].id == "bp_001"
288288
assert blueprints[1].id == "bp_002"
289-
mock_async_client.blueprints.list.assert_called_once()
289+
mock_async_client.blueprints.list.assert_awaited_once()
290290

291291

292292
class TestAsyncStorageObjectOps:
@@ -328,7 +328,7 @@ async def test_list_empty(self, mock_async_client: AsyncMock) -> None:
328328
objects = await ops.list(limit=10)
329329

330330
assert len(objects) == 0
331-
mock_async_client.objects.list.assert_called_once()
331+
mock_async_client.objects.list.assert_awaited_once()
332332

333333
@pytest.mark.asyncio
334334
async def test_list_single(self, mock_async_client: AsyncMock, object_view: MockObjectView) -> None:
@@ -374,7 +374,7 @@ async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
374374
assert isinstance(objects[1], AsyncStorageObject)
375375
assert objects[0].id == "obj_001"
376376
assert objects[1].id == "obj_002"
377-
mock_async_client.objects.list.assert_called_once()
377+
mock_async_client.objects.list.assert_awaited_once()
378378

379379
@pytest.mark.asyncio
380380
async def test_upload_from_file(
@@ -653,7 +653,7 @@ async def test_create(self, mock_async_client: AsyncMock, scorer_view: MockScore
653653

654654
assert isinstance(scorer, AsyncScorer)
655655
assert scorer.id == "scorer_123"
656-
mock_async_client.scenarios.scorers.create.assert_called_once()
656+
mock_async_client.scenarios.scorers.create.assert_awaited_once()
657657

658658
def test_from_id(self, mock_async_client: AsyncMock) -> None:
659659
"""Test from_id method."""
@@ -677,7 +677,7 @@ async def async_iter():
677677
scorers = await ops.list(limit=10)
678678

679679
assert len(scorers) == 0
680-
mock_async_client.scenarios.scorers.list.assert_called_once()
680+
mock_async_client.scenarios.scorers.list.assert_awaited_once()
681681

682682
@pytest.mark.asyncio
683683
async def test_list_single(self, mock_async_client: AsyncMock, scorer_view: MockScorerView) -> None:
@@ -697,7 +697,7 @@ async def async_iter():
697697
assert len(scorers) == 1
698698
assert isinstance(scorers[0], AsyncScorer)
699699
assert scorers[0].id == "scorer_123"
700-
mock_async_client.scenarios.scorers.list.assert_called_once()
700+
mock_async_client.scenarios.scorers.list.assert_awaited_once()
701701

702702
@pytest.mark.asyncio
703703
async def test_list_multiple(self, mock_async_client: AsyncMock) -> None:
@@ -719,7 +719,7 @@ async def async_iter():
719719
assert isinstance(scorers[1], AsyncScorer)
720720
assert scorers[0].id == "scorer_001"
721721
assert scorers[1].id == "scorer_002"
722-
mock_async_client.scenarios.scorers.list.assert_called_once()
722+
mock_async_client.scenarios.scorers.list.assert_awaited_once()
723723

724724

725725
class TestAsyncRunloopSDK:

tests/sdk/test_async_scorer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def test_get_info(self, mock_async_client: AsyncMock, scorer_view: MockSco
3838
result = await scorer.get_info()
3939

4040
assert result == scorer_view
41-
mock_async_client.scenarios.scorers.retrieve.assert_called_once()
41+
mock_async_client.scenarios.scorers.retrieve.assert_awaited_once()
4242

4343
@pytest.mark.asyncio
4444
async def test_update(self, mock_async_client: AsyncMock) -> None:
@@ -53,7 +53,7 @@ async def test_update(self, mock_async_client: AsyncMock) -> None:
5353
)
5454

5555
assert result == update_response
56-
mock_async_client.scenarios.scorers.update.assert_called_once()
56+
mock_async_client.scenarios.scorers.update.assert_awaited_once()
5757

5858
@pytest.mark.asyncio
5959
async def test_validate(self, mock_async_client: AsyncMock) -> None:
@@ -71,4 +71,4 @@ async def test_validate(self, mock_async_client: AsyncMock) -> None:
7171
)
7272

7373
assert result == validate_response
74-
mock_async_client.scenarios.scorers.validate.assert_called_once()
74+
mock_async_client.scenarios.scorers.validate.assert_awaited_once()

tests/sdk/test_async_snapshot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def test_get_info(self, mock_async_client: AsyncMock, snapshot_view: MockS
3939
)
4040

4141
assert result == snapshot_view
42-
mock_async_client.devboxes.disk_snapshots.query_status.assert_called_once()
42+
mock_async_client.devboxes.disk_snapshots.query_status.assert_awaited_once()
4343

4444
@pytest.mark.asyncio
4545
async def test_update(self, mock_async_client: AsyncMock) -> None:
@@ -60,7 +60,7 @@ async def test_update(self, mock_async_client: AsyncMock) -> None:
6060
)
6161

6262
assert result == updated_snapshot
63-
mock_async_client.devboxes.disk_snapshots.update.assert_called_once()
63+
mock_async_client.devboxes.disk_snapshots.update.assert_awaited_once()
6464

6565
@pytest.mark.asyncio
6666
async def test_delete(self, mock_async_client: AsyncMock) -> None:
@@ -77,7 +77,7 @@ async def test_delete(self, mock_async_client: AsyncMock) -> None:
7777
)
7878

7979
assert result is not None # Verify return value is propagated
80-
mock_async_client.devboxes.disk_snapshots.delete.assert_called_once()
80+
mock_async_client.devboxes.disk_snapshots.delete.assert_awaited_once()
8181

8282
@pytest.mark.asyncio
8383
async def test_await_completed(self, mock_async_client: AsyncMock, snapshot_view: MockSnapshotView) -> None:
@@ -95,7 +95,7 @@ async def test_await_completed(self, mock_async_client: AsyncMock, snapshot_view
9595
)
9696

9797
assert result == snapshot_view
98-
mock_async_client.devboxes.disk_snapshots.await_completed.assert_called_once()
98+
mock_async_client.devboxes.disk_snapshots.await_completed.assert_awaited_once()
9999

100100
@pytest.mark.asyncio
101101
async def test_create_devbox(self, mock_async_client: AsyncMock, devbox_view: MockDevboxView) -> None:
@@ -111,4 +111,4 @@ async def test_create_devbox(self, mock_async_client: AsyncMock, devbox_view: Mo
111111
)
112112

113113
assert devbox.id == "dev_123"
114-
mock_async_client.devboxes.create_and_await_running.assert_called_once()
114+
mock_async_client.devboxes.create_and_await_running.assert_awaited_once()

tests/sdk/test_async_storage_object.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def test_refresh(self, mock_async_client: AsyncMock, object_view: MockObje
4545
)
4646

4747
assert result == object_view
48-
mock_async_client.objects.retrieve.assert_called_once()
48+
mock_async_client.objects.retrieve.assert_awaited_once()
4949

5050
@pytest.mark.asyncio
5151
async def test_complete(self, mock_async_client: AsyncMock) -> None:
@@ -66,7 +66,7 @@ async def test_complete(self, mock_async_client: AsyncMock) -> None:
6666

6767
assert result == completed_view
6868
assert obj.upload_url is None
69-
mock_async_client.objects.complete.assert_called_once()
69+
mock_async_client.objects.complete.assert_awaited_once()
7070

7171
@pytest.mark.asyncio
7272
async def test_get_download_url_without_duration(self, mock_async_client: AsyncMock) -> None:
@@ -83,7 +83,7 @@ async def test_get_download_url_without_duration(self, mock_async_client: AsyncM
8383
)
8484

8585
assert result == download_url_view
86-
mock_async_client.objects.download.assert_called_once()
86+
mock_async_client.objects.download.assert_awaited_once()
8787

8888
@pytest.mark.asyncio
8989
async def test_get_download_url_with_duration(self, mock_async_client: AsyncMock) -> None:
@@ -101,7 +101,7 @@ async def test_get_download_url_with_duration(self, mock_async_client: AsyncMock
101101
)
102102

103103
assert result == download_url_view
104-
mock_async_client.objects.download.assert_called_once()
104+
mock_async_client.objects.download.assert_awaited_once()
105105

106106
@pytest.mark.asyncio
107107
async def test_download_as_bytes(self, mock_async_client: AsyncMock) -> None:
@@ -160,7 +160,7 @@ async def test_delete(self, mock_async_client: AsyncMock, object_view: MockObjec
160160
)
161161

162162
assert result == object_view
163-
mock_async_client.objects.delete.assert_called_once()
163+
mock_async_client.objects.delete.assert_awaited_once()
164164

165165
@pytest.mark.asyncio
166166
async def test_upload_content_string(self, mock_async_client: AsyncMock) -> None:

0 commit comments

Comments
 (0)