Skip to content

Commit 5056c05

Browse files
committed
Replace more UUID
1 parent 205f646 commit 5056c05

13 files changed

+127
-127
lines changed

tests/server/request_handlers/test_default_request_handler.py

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ async def test_on_message_send_interrupted_flow():
699699
request_context_builder=mock_request_context_builder,
700700
)
701701
params = MessageSendParams(
702-
message=Message(role=Role.user, message_id='msg_interrupt', parts=[])
702+
message=Message(role=Role.user, message_id='21b34182-195d-467a-9ed5-3160c8acd8f5', parts=[])
703703
)
704704

705705
mock_result_aggregator_instance = AsyncMock(spec=ResultAggregator)
@@ -756,8 +756,8 @@ async def test_on_message_send_stream_with_push_notification():
756756
mock_agent_executor = AsyncMock(spec=AgentExecutor)
757757
mock_request_context_builder = AsyncMock(spec=RequestContextBuilder)
758758

759-
task_id = 'stream_push_task_1'
760-
context_id = 'stream_push_ctx_1'
759+
task_id = '13662c2a-8544-4fd0-b052-60797780e15a'
760+
context_id = '3587eea8-d5e6-41c1-9aa9-9d8acb24797f'
761761

762762
# Initial task state for TaskManager
763763
initial_task_for_tm = create_sample_task(
@@ -1048,7 +1048,7 @@ async def test_on_message_send_stream_task_id_mismatch():
10481048
)
10491049
params = MessageSendParams(
10501050
message=Message(
1051-
role=Role.user, message_id='msg_stream_mismatch', parts=[]
1051+
role=Role.user, message_id='b990eddf-01d6-414d-90cb-02f8549debe9', parts=[]
10521052
)
10531053
)
10541054

@@ -1282,7 +1282,7 @@ async def test_get_task_push_notification_config_info_with_config():
12821282
)
12831283

12841284
set_config_params = TaskPushNotificationConfig(
1285-
task_id='task_1',
1285+
task_id='0a9970e3-0cdd-4726-899f-a1dfef92bd64',
12861286
push_notification_config=PushNotificationConfig(
12871287
id='81abbba0-e8eb-48e1-828b-75fd20663c34',
12881288
url='http://1.example.com',
@@ -1293,7 +1293,7 @@ async def test_get_task_push_notification_config_info_with_config():
12931293
)
12941294

12951295
params = GetTaskPushNotificationConfigParams(
1296-
id='task_1',
1296+
id='0a9970e3-0cdd-4726-899f-a1dfef92bd64',
12971297
push_notification_config_id='81abbba0-e8eb-48e1-828b-75fd20663c34',
12981298
)
12991299

@@ -1304,7 +1304,7 @@ async def test_get_task_push_notification_config_info_with_config():
13041304
)
13051305

13061306
assert result is not None
1307-
assert result.task_id == 'task_1'
1307+
assert result.task_id == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
13081308
assert (
13091309
result.push_notification_config.url
13101310
== set_config_params.push_notification_config.url
@@ -1329,7 +1329,7 @@ async def test_get_task_push_notification_config_info_with_config_no_id():
13291329
)
13301330

13311331
set_config_params = TaskPushNotificationConfig(
1332-
task_id='task_1',
1332+
task_id='0a9970e3-0cdd-4726-899f-a1dfef92bd64',
13331333
push_notification_config=PushNotificationConfig(
13341334
url='http://1.example.com'
13351335
),
@@ -1338,7 +1338,7 @@ async def test_get_task_push_notification_config_info_with_config_no_id():
13381338
set_config_params, create_server_call_context()
13391339
)
13401340

1341-
params = TaskIdParams(id='task_1')
1341+
params = TaskIdParams(id='0a9970e3-0cdd-4726-899f-a1dfef92bd64')
13421342

13431343
result: TaskPushNotificationConfig = (
13441344
await request_handler.on_get_task_push_notification_config(
@@ -1347,12 +1347,12 @@ async def test_get_task_push_notification_config_info_with_config_no_id():
13471347
)
13481348

13491349
assert result is not None
1350-
assert result.task_id == 'task_1'
1350+
assert result.task_id == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
13511351
assert (
13521352
result.push_notification_config.url
13531353
== set_config_params.push_notification_config.url
13541354
)
1355-
assert result.push_notification_config.id == 'task_1'
1355+
assert result.push_notification_config.id == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
13561356

13571357

13581358
@pytest.mark.asyncio
@@ -1364,7 +1364,7 @@ async def test_on_resubscribe_to_task_task_not_found():
13641364
request_handler = DefaultRequestHandler(
13651365
agent_executor=DummyAgentExecutor(), task_store=mock_task_store
13661366
)
1367-
params = TaskIdParams(id='resub_task_not_found')
1367+
params = TaskIdParams(id='8c897b3f-89a8-4692-aa72-4c33367d27b8')
13681368

13691369
from a2a.utils.errors import ServerError # Local import
13701370

@@ -1376,14 +1376,14 @@ async def test_on_resubscribe_to_task_task_not_found():
13761376
pass
13771377

13781378
assert isinstance(exc_info.value.error, TaskNotFoundError)
1379-
mock_task_store.get.assert_awaited_once_with('resub_task_not_found')
1379+
mock_task_store.get.assert_awaited_once_with('8c897b3f-89a8-4692-aa72-4c33367d27b8')
13801380

13811381

13821382
@pytest.mark.asyncio
13831383
async def test_on_resubscribe_to_task_queue_not_found():
13841384
"""Test on_resubscribe_to_task when the queue is not found by queue_manager.tap."""
13851385
mock_task_store = AsyncMock(spec=TaskStore)
1386-
sample_task = create_sample_task(task_id='resub_queue_not_found')
1386+
sample_task = create_sample_task(task_id='306589b7-57f8-48a0-8b8c-d1ab5aa237e0')
13871387
mock_task_store.get.return_value = sample_task
13881388

13891389
mock_queue_manager = AsyncMock(spec=QueueManager)
@@ -1394,7 +1394,7 @@ async def test_on_resubscribe_to_task_queue_not_found():
13941394
task_store=mock_task_store,
13951395
queue_manager=mock_queue_manager,
13961396
)
1397-
params = TaskIdParams(id='resub_queue_not_found')
1397+
params = TaskIdParams(id='306589b7-57f8-48a0-8b8c-d1ab5aa237e0')
13981398

13991399
from a2a.utils.errors import ServerError # Local import
14001400

@@ -1407,8 +1407,8 @@ async def test_on_resubscribe_to_task_queue_not_found():
14071407
assert isinstance(
14081408
exc_info.value.error, TaskNotFoundError
14091409
) # Should be TaskNotFoundError as per spec
1410-
mock_task_store.get.assert_awaited_once_with('resub_queue_not_found')
1411-
mock_queue_manager.tap.assert_awaited_once_with('resub_queue_not_found')
1410+
mock_task_store.get.assert_awaited_once_with('306589b7-57f8-48a0-8b8c-d1ab5aa237e0')
1411+
mock_queue_manager.tap.assert_awaited_once_with('306589b7-57f8-48a0-8b8c-d1ab5aa237e0')
14121412

14131413

14141414
@pytest.mark.asyncio
@@ -1542,15 +1542,15 @@ async def test_list_task_push_notification_config_info_with_config():
15421542
)
15431543

15441544
push_store = InMemoryPushNotificationConfigStore()
1545-
await push_store.set_info('task_1', push_config1)
1546-
await push_store.set_info('task_1', push_config2)
1545+
await push_store.set_info('0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_config1)
1546+
await push_store.set_info('0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_config2)
15471547

15481548
request_handler = DefaultRequestHandler(
15491549
agent_executor=DummyAgentExecutor(),
15501550
task_store=mock_task_store,
15511551
push_config_store=push_store,
15521552
)
1553-
params = ListTaskPushNotificationConfigParams(id='task_1')
1553+
params = ListTaskPushNotificationConfigParams(id='0a9970e3-0cdd-4726-899f-a1dfef92bd64')
15541554

15551555
result: list[
15561556
TaskPushNotificationConfig
@@ -1559,9 +1559,9 @@ async def test_list_task_push_notification_config_info_with_config():
15591559
)
15601560

15611561
assert len(result) == 2
1562-
assert result[0].task_id == 'task_1'
1562+
assert str(result[0].task_id) == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
15631563
assert result[0].push_notification_config == push_config1
1564-
assert result[1].task_id == 'task_1'
1564+
assert str(result[1].task_id) == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
15651565
assert result[1].push_notification_config == push_config2
15661566

15671567

@@ -1580,7 +1580,7 @@ async def test_list_task_push_notification_config_info_with_config_and_no_id():
15801580

15811581
# multiple calls without config id should replace the existing
15821582
set_config_params1 = TaskPushNotificationConfig(
1583-
task_id='task_1',
1583+
task_id='0a9970e3-0cdd-4726-899f-a1dfef92bd64',
15841584
push_notification_config=PushNotificationConfig(
15851585
url='http://1.example.com'
15861586
),
@@ -1590,7 +1590,7 @@ async def test_list_task_push_notification_config_info_with_config_and_no_id():
15901590
)
15911591

15921592
set_config_params2 = TaskPushNotificationConfig(
1593-
task_id='task_1',
1593+
task_id='0a9970e3-0cdd-4726-899f-a1dfef92bd64',
15941594
push_notification_config=PushNotificationConfig(
15951595
url='http://2.example.com'
15961596
),
@@ -1599,7 +1599,7 @@ async def test_list_task_push_notification_config_info_with_config_and_no_id():
15991599
set_config_params2, create_server_call_context()
16001600
)
16011601

1602-
params = ListTaskPushNotificationConfigParams(id='task_1')
1602+
params = ListTaskPushNotificationConfigParams(id='0a9970e3-0cdd-4726-899f-a1dfef92bd64')
16031603

16041604
result: list[
16051605
TaskPushNotificationConfig
@@ -1608,12 +1608,12 @@ async def test_list_task_push_notification_config_info_with_config_and_no_id():
16081608
)
16091609

16101610
assert len(result) == 1
1611-
assert result[0].task_id == 'task_1'
1611+
assert str(result[0].task_id) == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
16121612
assert (
16131613
result[0].push_notification_config.url
16141614
== set_config_params2.push_notification_config.url
16151615
)
1616-
assert result[0].push_notification_config.id == 'task_1'
1616+
assert str(result[0].push_notification_config.id) == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
16171617

16181618

16191619
@pytest.mark.asyncio
@@ -1626,7 +1626,7 @@ async def test_delete_task_push_notification_config_no_store():
16261626
)
16271627
params = DeleteTaskPushNotificationConfigParams(
16281628
id='13d5b8a8-62d7-4490-98c8-d3951b42702a',
1629-
push_notification_config_id='config1',
1629+
push_notification_config_id='2fbdf017-d3d0-498f-9135-ebf8d2ae8492',
16301630
)
16311631
from a2a.utils.errors import ServerError # Local import
16321632

@@ -1651,7 +1651,7 @@ async def test_delete_task_push_notification_config_task_not_found():
16511651
)
16521652
params = DeleteTaskPushNotificationConfigParams(
16531653
id='b87b95a6-cf02-4d0a-8355-eb9cf307d323',
1654-
push_notification_config_id='config1',
1654+
push_notification_config_id='2fbdf017-d3d0-498f-9135-ebf8d2ae8492',
16551655
)
16561656
from a2a.utils.errors import ServerError # Local import
16571657

@@ -1672,7 +1672,7 @@ async def test_delete_no_task_push_notification_config_info():
16721672
"""Test on_delete_task_push_notification_config without config info"""
16731673
mock_task_store = AsyncMock(spec=TaskStore)
16741674

1675-
sample_task = create_sample_task(task_id='task_1')
1675+
sample_task = create_sample_task(task_id='0a9970e3-0cdd-4726-899f-a1dfef92bd64')
16761676
mock_task_store.get.return_value = sample_task
16771677

16781678
push_store = InMemoryPushNotificationConfigStore()
@@ -1724,8 +1724,8 @@ async def test_delete_task_push_notification_config_info_with_config():
17241724
)
17251725

17261726
push_store = InMemoryPushNotificationConfigStore()
1727-
await push_store.set_info('task_1', push_config1)
1728-
await push_store.set_info('task_1', push_config2)
1727+
await push_store.set_info('0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_config1)
1728+
await push_store.set_info('0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_config2)
17291729
await push_store.set_info('task_2', push_config1)
17301730

17311731
request_handler = DefaultRequestHandler(
@@ -1734,7 +1734,7 @@ async def test_delete_task_push_notification_config_info_with_config():
17341734
push_config_store=push_store,
17351735
)
17361736
params = DeleteTaskPushNotificationConfigParams(
1737-
id='task_1', push_notification_config_id='config_1'
1737+
id='0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_notification_config_id='config_1'
17381738
)
17391739

17401740
result1 = await request_handler.on_delete_task_push_notification_config(
@@ -1744,12 +1744,12 @@ async def test_delete_task_push_notification_config_info_with_config():
17441744
assert result1 is None
17451745

17461746
result2 = await request_handler.on_list_task_push_notification_config(
1747-
ListTaskPushNotificationConfigParams(id='task_1'),
1747+
ListTaskPushNotificationConfigParams(id='0a9970e3-0cdd-4726-899f-a1dfef92bd64'),
17481748
create_server_call_context(),
17491749
)
17501750

17511751
assert len(result2) == 1
1752-
assert result2[0].task_id == 'task_1'
1752+
assert result2[0].task_id == '0a9970e3-0cdd-4726-899f-a1dfef92bd64'
17531753
assert result2[0].push_notification_config == push_config2
17541754

17551755

@@ -1767,16 +1767,16 @@ async def test_delete_task_push_notification_config_info_with_config_and_no_id()
17671767

17681768
# insertion without id should replace the existing config
17691769
push_store = InMemoryPushNotificationConfigStore()
1770-
await push_store.set_info('task_1', push_config)
1771-
await push_store.set_info('task_1', push_config)
1770+
await push_store.set_info('0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_config)
1771+
await push_store.set_info('0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_config)
17721772

17731773
request_handler = DefaultRequestHandler(
17741774
agent_executor=DummyAgentExecutor(),
17751775
task_store=mock_task_store,
17761776
push_config_store=push_store,
17771777
)
17781778
params = DeleteTaskPushNotificationConfigParams(
1779-
id='task_1', push_notification_config_id='task_1'
1779+
id='0a9970e3-0cdd-4726-899f-a1dfef92bd64', push_notification_config_id='0a9970e3-0cdd-4726-899f-a1dfef92bd64'
17801780
)
17811781

17821782
result = await request_handler.on_delete_task_push_notification_config(
@@ -1786,7 +1786,7 @@ async def test_delete_task_push_notification_config_info_with_config_and_no_id()
17861786
assert result is None
17871787

17881788
result2 = await request_handler.on_list_task_push_notification_config(
1789-
ListTaskPushNotificationConfigParams(id='task_1'),
1789+
ListTaskPushNotificationConfigParams(id='0a9970e3-0cdd-4726-899f-a1dfef92bd64'),
17901790
create_server_call_context(),
17911791
)
17921792

@@ -1931,7 +1931,7 @@ async def test_on_resubscribe_to_task_in_terminal_state(terminal_state):
19311931
@pytest.mark.asyncio
19321932
async def test_on_message_send_task_id_provided_but_task_not_found():
19331933
"""Test on_message_send when task_id is provided but task doesn't exist."""
1934-
task_id = 'nonexistent_task'
1934+
task_id = 'd95515a2-b95b-4706-a4d2-b1d2e8b068d0'
19351935
mock_task_store = AsyncMock(spec=TaskStore)
19361936

19371937
request_handler = DefaultRequestHandler(
@@ -1941,7 +1941,7 @@ async def test_on_message_send_task_id_provided_but_task_not_found():
19411941
params = MessageSendParams(
19421942
message=Message(
19431943
role=Role.user,
1944-
message_id='msg_nonexistent',
1944+
message_id='c5e7c368-8f16-4518-bd4a-d61be13858fe',
19451945
parts=[Part(root=TextPart(text='Hello'))],
19461946
task_id=task_id,
19471947
context_id='06cc947f-8946-4bde-b776-165462407e57',
@@ -1971,7 +1971,7 @@ async def test_on_message_send_task_id_provided_but_task_not_found():
19711971
@pytest.mark.asyncio
19721972
async def test_on_message_send_stream_task_id_provided_but_task_not_found():
19731973
"""Test on_message_send_stream when task_id is provided but task doesn't exist."""
1974-
task_id = 'nonexistent_stream_task'
1974+
task_id = 'e4cc2ed4-117c-4bc6-90a4-415f0a7dec5a'
19751975
mock_task_store = AsyncMock(spec=TaskStore)
19761976

19771977
request_handler = DefaultRequestHandler(
@@ -1981,7 +1981,7 @@ async def test_on_message_send_stream_task_id_provided_but_task_not_found():
19811981
params = MessageSendParams(
19821982
message=Message(
19831983
role=Role.user,
1984-
message_id='msg_nonexistent_stream',
1984+
message_id='e3d82e74-63ac-4603-b54a-fce0bb01c447',
19851985
parts=[Part(root=TextPart(text='Hello'))],
19861986
task_id=task_id,
19871987
context_id='06cc947f-8946-4bde-b776-165462407e57',

0 commit comments

Comments
 (0)