Skip to content

Commit 3d09d33

Browse files
Update more tests
1 parent 6d139f4 commit 3d09d33

File tree

2 files changed

+44
-13
lines changed

2 files changed

+44
-13
lines changed

tests/server/request_handlers/test_default_request_handler.py

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ async def test_on_get_task_not_found():
139139
await request_handler.on_get_task(params, create_server_call_context())
140140

141141
assert isinstance(exc_info.value.error, TaskNotFoundError)
142-
mock_task_store.get.assert_awaited_once_with('non_existent_task')
142+
mock_task_store.get.assert_awaited_once_with(
143+
'non_existent_task', create_server_call_context()
144+
)
143145

144146

145147
@pytest.mark.asyncio
@@ -161,7 +163,10 @@ async def test_on_cancel_task_task_not_found():
161163
)
162164

163165
assert isinstance(exc_info.value.error, TaskNotFoundError)
164-
mock_task_store.get.assert_awaited_once_with('task_not_found_for_cancel')
166+
mock_task_store.get.assert_awaited_once_with(
167+
'task_not_found_for_cancel',
168+
create_server_call_context()
169+
)
165170

166171

167172
@pytest.mark.asyncio
@@ -204,7 +209,10 @@ async def test_on_cancel_task_queue_tap_returns_none():
204209
params, create_server_call_context()
205210
)
206211

207-
mock_task_store.get.assert_awaited_once_with('tap_none_task')
212+
mock_task_store.get.assert_awaited_once_with(
213+
'tap_none_task',
214+
create_server_call_context()
215+
)
208216
mock_queue_manager.tap.assert_awaited_once_with('tap_none_task')
209217
# agent_executor.cancel should be called with a new EventQueue if tap returned None
210218
mock_agent_executor.cancel.assert_awaited_once()
@@ -1278,7 +1286,10 @@ async def test_set_task_push_notification_config_task_not_found():
12781286
)
12791287

12801288
assert isinstance(exc_info.value.error, TaskNotFoundError)
1281-
mock_task_store.get.assert_awaited_once_with('non_existent_task')
1289+
mock_task_store.get.assert_awaited_once_with(
1290+
'non_existent_task',
1291+
create_server_call_context()
1292+
)
12821293
mock_push_store.set_info.assert_not_awaited()
12831294

12841295

@@ -1321,7 +1332,10 @@ async def test_get_task_push_notification_config_task_not_found():
13211332
)
13221333

13231334
assert isinstance(exc_info.value.error, TaskNotFoundError)
1324-
mock_task_store.get.assert_awaited_once_with('non_existent_task')
1335+
mock_task_store.get.assert_awaited_once_with(
1336+
'non_existent_task',
1337+
create_server_call_context()
1338+
)
13251339
mock_push_store.get_info.assert_not_awaited()
13261340

13271341

@@ -1352,7 +1366,10 @@ async def test_get_task_push_notification_config_info_not_found():
13521366
assert isinstance(
13531367
exc_info.value.error, InternalError
13541368
) # Current code raises InternalError
1355-
mock_task_store.get.assert_awaited_once_with('non_existent_task')
1369+
mock_task_store.get.assert_awaited_once_with(
1370+
'non_existent_task',
1371+
create_server_call_context()
1372+
)
13561373
mock_push_store.get_info.assert_awaited_once_with('non_existent_task')
13571374

13581375

@@ -1459,7 +1476,10 @@ async def test_on_resubscribe_to_task_task_not_found():
14591476
pass
14601477

14611478
assert isinstance(exc_info.value.error, TaskNotFoundError)
1462-
mock_task_store.get.assert_awaited_once_with('resub_task_not_found')
1479+
mock_task_store.get.assert_awaited_once_with(
1480+
'resub_task_not_found',
1481+
create_server_call_context()
1482+
)
14631483

14641484

14651485
@pytest.mark.asyncio
@@ -1490,7 +1510,10 @@ async def test_on_resubscribe_to_task_queue_not_found():
14901510
assert isinstance(
14911511
exc_info.value.error, TaskNotFoundError
14921512
) # Should be TaskNotFoundError as per spec
1493-
mock_task_store.get.assert_awaited_once_with('resub_queue_not_found')
1513+
mock_task_store.get.assert_awaited_once_with(
1514+
'resub_queue_not_found',
1515+
create_server_call_context()
1516+
)
14941517
mock_queue_manager.tap.assert_awaited_once_with('resub_queue_not_found')
14951518

14961519

@@ -1570,7 +1593,10 @@ async def test_list_task_push_notification_config_task_not_found():
15701593
)
15711594

15721595
assert isinstance(exc_info.value.error, TaskNotFoundError)
1573-
mock_task_store.get.assert_awaited_once_with('non_existent_task')
1596+
mock_task_store.get.assert_awaited_once_with(
1597+
'non_existent_task',
1598+
create_server_call_context()
1599+
)
15741600
mock_push_store.get_info.assert_not_awaited()
15751601

15761602

@@ -1730,7 +1756,10 @@ async def test_delete_task_push_notification_config_task_not_found():
17301756
)
17311757

17321758
assert isinstance(exc_info.value.error, TaskNotFoundError)
1733-
mock_task_store.get.assert_awaited_once_with('non_existent_task')
1759+
mock_task_store.get.assert_awaited_once_with(
1760+
'non_existent_task',
1761+
create_server_call_context()
1762+
)
17341763
mock_push_store.get_info.assert_not_awaited()
17351764

17361765

@@ -1987,7 +2016,9 @@ async def test_on_resubscribe_to_task_in_terminal_state(terminal_state):
19872016
f'Task {task_id} is in terminal state: {terminal_state.value}'
19882017
in exc_info.value.error.message
19892018
)
1990-
mock_task_store.get.assert_awaited_once_with(task_id)
2019+
mock_task_store.get.assert_awaited_once_with(
2020+
task_id, create_server_call_context()
2021+
)
19912022

19922023

19932024
@pytest.mark.asyncio

tests/server/tasks/test_task_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async def test_save_task_event_status_update(
116116
await task_manager.save_task_event(event)
117117
updated_task = initial_task
118118
updated_task.status = new_status
119-
mock_task_store.save.assert_called_once_with(updated_task)
119+
mock_task_store.save.assert_called_once_with(updated_task, None)
120120

121121

122122
@pytest.mark.asyncio
@@ -139,7 +139,7 @@ async def test_save_task_event_artifact_update(
139139
await task_manager.save_task_event(event)
140140
updated_task = initial_task
141141
updated_task.artifacts = [new_artifact]
142-
mock_task_store.save.assert_called_once_with(updated_task)
142+
mock_task_store.save.assert_called_once_with(updated_task, None)
143143

144144

145145
@pytest.mark.asyncio

0 commit comments

Comments
 (0)