@@ -14,8 +14,13 @@ async def test_create_agent(mock_api, http_transport):
1414 """POST /v1/Account/TESTAUTH123/Agent creates an agent."""
1515 mock_api .post ("/v1/Account/TESTAUTH123/Agent" ).mock (
1616 return_value = httpx .Response (
17- 200 ,
18- json = {"agent_uuid" : AGENT_UUID , "agent_name" : "My Agent" },
17+ 201 ,
18+ json = {
19+ "api_id" : "abc-123" ,
20+ "message" : "agent created" ,
21+ "agent_uuid" : AGENT_UUID ,
22+ "agent_name" : "My Agent" ,
23+ },
1924 )
2025 )
2126 client = AgentClient (http_transport )
@@ -29,7 +34,7 @@ async def test_get_agent(mock_api, http_transport):
2934 mock_api .get (f"/v1/Account/TESTAUTH123/Agent/{ AGENT_UUID } " ).mock (
3035 return_value = httpx .Response (
3136 200 ,
32- json = {"agent_uuid" : AGENT_UUID , "agent_name" : "My Agent" },
37+ json = {"api_id" : "abc-123" , " agent_uuid" : AGENT_UUID , "agent_name" : "My Agent" },
3338 )
3439 )
3540 client = AgentClient (http_transport )
@@ -42,21 +47,31 @@ async def test_list_agents(mock_api, http_transport):
4247 mock_api .get ("/v1/Account/TESTAUTH123/Agent" ).mock (
4348 return_value = httpx .Response (
4449 200 ,
45- json = {"data" : [{"agent_uuid" : AGENT_UUID }], "meta" : {"total" : 1 }},
50+ json = {
51+ "api_id" : "abc-123" ,
52+ "objects" : [{"agent_uuid" : AGENT_UUID }],
53+ "meta" : {
54+ "limit" : 10 ,
55+ "offset" : 0 ,
56+ "total_count" : 1 ,
57+ "previous" : None ,
58+ "next" : None ,
59+ },
60+ },
4661 )
4762 )
4863 client = AgentClient (http_transport )
49- result = await client .agents .list (page = 1 , per_page = 10 )
50- assert result ["meta" ]["total " ] == 1
51- assert len (result ["data " ]) == 1
64+ result = await client .agents .list (limit = 10 , offset = 0 )
65+ assert result ["meta" ]["total_count " ] == 1
66+ assert len (result ["objects " ]) == 1
5267
5368
5469async def test_update_agent (mock_api , http_transport ):
5570 """PATCH /v1/Account/TESTAUTH123/Agent/{uuid} updates an agent."""
5671 mock_api .patch (f"/v1/Account/TESTAUTH123/Agent/{ AGENT_UUID } " ).mock (
5772 return_value = httpx .Response (
5873 200 ,
59- json = {"agent_uuid" : AGENT_UUID , "agent_name" : "Updated Agent" },
74+ json = {"api_id" : "abc-123" , " agent_uuid" : AGENT_UUID , "agent_name" : "Updated Agent" },
6075 )
6176 )
6277 client = AgentClient (http_transport )
@@ -78,8 +93,13 @@ async def test_call_initiate(mock_api, http_transport):
7893 """POST /v1/Account/TESTAUTH123/AgentCall initiates an outbound call."""
7994 mock_api .post ("/v1/Account/TESTAUTH123/AgentCall" ).mock (
8095 return_value = httpx .Response (
81- 200 ,
82- json = {"call_uuid" : CALL_UUID , "status" : "initiated" },
96+ 201 ,
97+ json = {
98+ "api_id" : "abc-123" ,
99+ "message" : "call initiated" ,
100+ "call_uuid" : CALL_UUID ,
101+ "status" : "initiated" ,
102+ },
83103 )
84104 )
85105 client = AgentClient (http_transport )
@@ -96,26 +116,37 @@ async def test_call_connect(mock_api, http_transport):
96116 """POST /v1/Account/TESTAUTH123/AgentCall/{uuid}/connect connects a call to an agent."""
97117 mock_api .post (f"/v1/Account/TESTAUTH123/AgentCall/{ CALL_UUID } /connect" ).mock (
98118 return_value = httpx .Response (
99- 200 ,
100- json = {"status" : "connected" },
119+ 201 ,
120+ json = {
121+ "api_id" : "abc-123" ,
122+ "message" : "call connected" ,
123+ "agent_session_id" : "sess-001" ,
124+ "status" : "connecting" ,
125+ },
101126 )
102127 )
103128 client = AgentClient (http_transport )
104129 result = await client .calls .connect (CALL_UUID , AGENT_UUID )
105- assert result ["status" ] == "connected"
130+ assert result ["status" ] == "connecting"
131+ assert result ["agent_session_id" ] == "sess-001"
106132
107133
108134async def test_number_assign (mock_api , http_transport ):
109135 """POST /v1/Account/TESTAUTH123/Agent/{uuid}/Number assigns a number to an agent."""
110136 mock_api .post (f"/v1/Account/TESTAUTH123/Agent/{ AGENT_UUID } /Number" ).mock (
111137 return_value = httpx .Response (
112- 200 ,
113- json = {"status" : "assigned" , "number" : "+14155551234" },
138+ 201 ,
139+ json = {
140+ "api_id" : "abc-123" ,
141+ "message" : "number assigned" ,
142+ "agent_uuid" : AGENT_UUID ,
143+ "number" : "+14155551234" ,
144+ },
114145 )
115146 )
116147 client = AgentClient (http_transport )
117148 result = await client .numbers .assign (AGENT_UUID , "+14155551234" )
118- assert result ["status " ] == "assigned"
149+ assert result ["message " ] == "number assigned"
119150 assert result ["number" ] == "+14155551234"
120151
121152
@@ -139,17 +170,24 @@ async def test_session_list(mock_api, http_transport):
139170 return_value = httpx .Response (
140171 200 ,
141172 json = {
142- "data" : [
173+ "api_id" : "abc-123" ,
174+ "objects" : [
143175 {"agent_session_id" : SESSION_ID , "duration_seconds" : 120 }
144176 ],
145- "meta" : {"total" : 1 },
177+ "meta" : {
178+ "limit" : 10 ,
179+ "offset" : 0 ,
180+ "total_count" : 1 ,
181+ "previous" : None ,
182+ "next" : None ,
183+ },
146184 },
147185 )
148186 )
149187 client = AgentClient (http_transport )
150- result = await client .sessions .list (AGENT_UUID , page = 1 , per_page = 10 )
151- assert result ["meta" ]["total " ] == 1
152- assert result ["data " ][0 ]["agent_session_id" ] == SESSION_ID
188+ result = await client .sessions .list (AGENT_UUID , limit = 10 , offset = 0 )
189+ assert result ["meta" ]["total_count " ] == 1
190+ assert result ["objects " ][0 ]["agent_session_id" ] == SESSION_ID
153191
154192
155193async def test_session_get (mock_api , http_transport ):
@@ -158,6 +196,7 @@ async def test_session_get(mock_api, http_transport):
158196 return_value = httpx .Response (
159197 200 ,
160198 json = {
199+ "api_id" : "abc-123" ,
161200 "agent_session_id" : SESSION_ID ,
162201 "agent_uuid" : AGENT_UUID ,
163202 "duration_seconds" : 120 ,
0 commit comments