Debian Codegraph @

tests/api_resources/beta/sessions/test_resources.py

raw
1 from __future__ import annotations
2
3 import os
4 from typing import Any, cast
5
6 import pytest
7
8 from anthropic import Anthropic, AsyncAnthropic
9 from tests.utils import assert_matches_type
10 from anthropic.pagination import SyncPageCursor, AsyncPageCursor
11 from anthropic.types.beta.sessions import (
12 ResourceUpdateResponse,
13 ResourceRetrieveResponse,
14 BetaManagedAgentsFileResource,
15 BetaManagedAgentsSessionResource,
16 BetaManagedAgentsDeleteSessionResource,
17 )
18
19 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
20
21
22 class TestResources:
23 parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
24
25 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
26 @parametrize
27 def test_method_retrieve(self, client: Anthropic) -> None:
28 resource = client.beta.sessions.resources.retrieve(
29 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
30 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
31 )
32 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
33
34 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
35 @parametrize
36 def test_method_retrieve_with_all_params(self, client: Anthropic) -> None:
37 resource = client.beta.sessions.resources.retrieve(
38 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
39 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
40 betas=["message-batches-2024-09-24"],
41 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
42 )
43 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
44
45 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
46 @parametrize
47 def test_raw_response_retrieve(self, client: Anthropic) -> None:
48 response = client.beta.sessions.resources.with_raw_response.retrieve(
49 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
50 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
51 )
52
53 assert response.is_closed is True
54 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
55 resource = response.parse()
56 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
57
58 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
59 @parametrize
60 def test_streaming_response_retrieve(self, client: Anthropic) -> None:
61 with client.beta.sessions.resources.with_streaming_response.retrieve(
62 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
63 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
64 ) as response:
65 assert not response.is_closed
66 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
67
68 resource = response.parse()
69 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
70
71 assert cast(Any, response.is_closed) is True
72
73 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
74 @parametrize
75 def test_path_params_retrieve(self, client: Anthropic) -> None:
76 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
77 client.beta.sessions.resources.with_raw_response.retrieve(
78 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
79 session_id="",
80 )
81
82 with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_id` but received ''"):
83 client.beta.sessions.resources.with_raw_response.retrieve(
84 resource_id="",
85 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
86 )
87
88 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
89 @parametrize
90 def test_method_update(self, client: Anthropic) -> None:
91 resource = client.beta.sessions.resources.update(
92 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
93 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
94 authorization_token="ghp_exampletoken",
95 )
96 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
97
98 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
99 @parametrize
100 def test_method_update_with_all_params(self, client: Anthropic) -> None:
101 resource = client.beta.sessions.resources.update(
102 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
103 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
104 authorization_token="ghp_exampletoken",
105 betas=["message-batches-2024-09-24"],
106 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
107 )
108 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
109
110 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
111 @parametrize
112 def test_raw_response_update(self, client: Anthropic) -> None:
113 response = client.beta.sessions.resources.with_raw_response.update(
114 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
115 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
116 authorization_token="ghp_exampletoken",
117 )
118
119 assert response.is_closed is True
120 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
121 resource = response.parse()
122 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
123
124 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
125 @parametrize
126 def test_streaming_response_update(self, client: Anthropic) -> None:
127 with client.beta.sessions.resources.with_streaming_response.update(
128 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
129 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
130 authorization_token="ghp_exampletoken",
131 ) as response:
132 assert not response.is_closed
133 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
134
135 resource = response.parse()
136 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
137
138 assert cast(Any, response.is_closed) is True
139
140 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
141 @parametrize
142 def test_path_params_update(self, client: Anthropic) -> None:
143 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
144 client.beta.sessions.resources.with_raw_response.update(
145 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
146 session_id="",
147 authorization_token="ghp_exampletoken",
148 )
149
150 with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_id` but received ''"):
151 client.beta.sessions.resources.with_raw_response.update(
152 resource_id="",
153 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
154 authorization_token="ghp_exampletoken",
155 )
156
157 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
158 @parametrize
159 def test_method_list(self, client: Anthropic) -> None:
160 resource = client.beta.sessions.resources.list(
161 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
162 )
163 assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
164
165 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
166 @parametrize
167 def test_method_list_with_all_params(self, client: Anthropic) -> None:
168 resource = client.beta.sessions.resources.list(
169 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
170 limit=0,
171 page="page",
172 betas=["message-batches-2024-09-24"],
173 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
174 )
175 assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
176
177 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
178 @parametrize
179 def test_raw_response_list(self, client: Anthropic) -> None:
180 response = client.beta.sessions.resources.with_raw_response.list(
181 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
182 )
183
184 assert response.is_closed is True
185 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
186 resource = response.parse()
187 assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
188
189 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
190 @parametrize
191 def test_streaming_response_list(self, client: Anthropic) -> None:
192 with client.beta.sessions.resources.with_streaming_response.list(
193 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
194 ) as response:
195 assert not response.is_closed
196 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
197
198 resource = response.parse()
199 assert_matches_type(SyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
200
201 assert cast(Any, response.is_closed) is True
202
203 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
204 @parametrize
205 def test_path_params_list(self, client: Anthropic) -> None:
206 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
207 client.beta.sessions.resources.with_raw_response.list(
208 session_id="",
209 )
210
211 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
212 @parametrize
213 def test_method_delete(self, client: Anthropic) -> None:
214 resource = client.beta.sessions.resources.delete(
215 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
216 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
217 )
218 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
219
220 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
221 @parametrize
222 def test_method_delete_with_all_params(self, client: Anthropic) -> None:
223 resource = client.beta.sessions.resources.delete(
224 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
225 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
226 betas=["message-batches-2024-09-24"],
227 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
228 )
229 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
230
231 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
232 @parametrize
233 def test_raw_response_delete(self, client: Anthropic) -> None:
234 response = client.beta.sessions.resources.with_raw_response.delete(
235 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
236 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
237 )
238
239 assert response.is_closed is True
240 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
241 resource = response.parse()
242 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
243
244 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
245 @parametrize
246 def test_streaming_response_delete(self, client: Anthropic) -> None:
247 with client.beta.sessions.resources.with_streaming_response.delete(
248 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
249 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
250 ) as response:
251 assert not response.is_closed
252 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
253
254 resource = response.parse()
255 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
256
257 assert cast(Any, response.is_closed) is True
258
259 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
260 @parametrize
261 def test_path_params_delete(self, client: Anthropic) -> None:
262 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
263 client.beta.sessions.resources.with_raw_response.delete(
264 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
265 session_id="",
266 )
267
268 with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_id` but received ''"):
269 client.beta.sessions.resources.with_raw_response.delete(
270 resource_id="",
271 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
272 )
273
274 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
275 @parametrize
276 def test_method_add(self, client: Anthropic) -> None:
277 resource = client.beta.sessions.resources.add(
278 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
279 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
280 type="file",
281 )
282 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
283
284 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
285 @parametrize
286 def test_method_add_with_all_params(self, client: Anthropic) -> None:
287 resource = client.beta.sessions.resources.add(
288 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
289 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
290 type="file",
291 mount_path="/uploads/receipt.pdf",
292 betas=["message-batches-2024-09-24"],
293 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
294 )
295 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
296
297 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
298 @parametrize
299 def test_raw_response_add(self, client: Anthropic) -> None:
300 response = client.beta.sessions.resources.with_raw_response.add(
301 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
302 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
303 type="file",
304 )
305
306 assert response.is_closed is True
307 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
308 resource = response.parse()
309 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
310
311 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
312 @parametrize
313 def test_streaming_response_add(self, client: Anthropic) -> None:
314 with client.beta.sessions.resources.with_streaming_response.add(
315 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
316 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
317 type="file",
318 ) as response:
319 assert not response.is_closed
320 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
321
322 resource = response.parse()
323 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
324
325 assert cast(Any, response.is_closed) is True
326
327 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
328 @parametrize
329 def test_path_params_add(self, client: Anthropic) -> None:
330 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
331 client.beta.sessions.resources.with_raw_response.add(
332 session_id="",
333 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
334 type="file",
335 )
336
337
338 class TestAsyncResources:
339 parametrize = pytest.mark.parametrize(
340 "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
341 )
342
343 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
344 @parametrize
345 async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None:
346 resource = await async_client.beta.sessions.resources.retrieve(
347 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
348 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
349 )
350 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
351
352 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
353 @parametrize
354 async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None:
355 resource = await async_client.beta.sessions.resources.retrieve(
356 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
357 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
358 betas=["message-batches-2024-09-24"],
359 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
360 )
361 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
362
363 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
364 @parametrize
365 async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None:
366 response = await async_client.beta.sessions.resources.with_raw_response.retrieve(
367 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
368 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
369 )
370
371 assert response.is_closed is True
372 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
373 resource = await response.parse()
374 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
375
376 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
377 @parametrize
378 async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None:
379 async with async_client.beta.sessions.resources.with_streaming_response.retrieve(
380 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
381 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
382 ) as response:
383 assert not response.is_closed
384 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
385
386 resource = await response.parse()
387 assert_matches_type(ResourceRetrieveResponse, resource, path=["response"])
388
389 assert cast(Any, response.is_closed) is True
390
391 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
392 @parametrize
393 async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None:
394 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
395 await async_client.beta.sessions.resources.with_raw_response.retrieve(
396 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
397 session_id="",
398 )
399
400 with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_id` but received ''"):
401 await async_client.beta.sessions.resources.with_raw_response.retrieve(
402 resource_id="",
403 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
404 )
405
406 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
407 @parametrize
408 async def test_method_update(self, async_client: AsyncAnthropic) -> None:
409 resource = await async_client.beta.sessions.resources.update(
410 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
411 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
412 authorization_token="ghp_exampletoken",
413 )
414 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
415
416 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
417 @parametrize
418 async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) -> None:
419 resource = await async_client.beta.sessions.resources.update(
420 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
421 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
422 authorization_token="ghp_exampletoken",
423 betas=["message-batches-2024-09-24"],
424 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
425 )
426 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
427
428 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
429 @parametrize
430 async def test_raw_response_update(self, async_client: AsyncAnthropic) -> None:
431 response = await async_client.beta.sessions.resources.with_raw_response.update(
432 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
433 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
434 authorization_token="ghp_exampletoken",
435 )
436
437 assert response.is_closed is True
438 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
439 resource = await response.parse()
440 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
441
442 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
443 @parametrize
444 async def test_streaming_response_update(self, async_client: AsyncAnthropic) -> None:
445 async with async_client.beta.sessions.resources.with_streaming_response.update(
446 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
447 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
448 authorization_token="ghp_exampletoken",
449 ) as response:
450 assert not response.is_closed
451 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
452
453 resource = await response.parse()
454 assert_matches_type(ResourceUpdateResponse, resource, path=["response"])
455
456 assert cast(Any, response.is_closed) is True
457
458 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
459 @parametrize
460 async def test_path_params_update(self, async_client: AsyncAnthropic) -> None:
461 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
462 await async_client.beta.sessions.resources.with_raw_response.update(
463 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
464 session_id="",
465 authorization_token="ghp_exampletoken",
466 )
467
468 with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_id` but received ''"):
469 await async_client.beta.sessions.resources.with_raw_response.update(
470 resource_id="",
471 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
472 authorization_token="ghp_exampletoken",
473 )
474
475 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
476 @parametrize
477 async def test_method_list(self, async_client: AsyncAnthropic) -> None:
478 resource = await async_client.beta.sessions.resources.list(
479 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
480 )
481 assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
482
483 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
484 @parametrize
485 async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None:
486 resource = await async_client.beta.sessions.resources.list(
487 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
488 limit=0,
489 page="page",
490 betas=["message-batches-2024-09-24"],
491 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
492 )
493 assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
494
495 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
496 @parametrize
497 async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
498 response = await async_client.beta.sessions.resources.with_raw_response.list(
499 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
500 )
501
502 assert response.is_closed is True
503 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
504 resource = await response.parse()
505 assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
506
507 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
508 @parametrize
509 async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None:
510 async with async_client.beta.sessions.resources.with_streaming_response.list(
511 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
512 ) as response:
513 assert not response.is_closed
514 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
515
516 resource = await response.parse()
517 assert_matches_type(AsyncPageCursor[BetaManagedAgentsSessionResource], resource, path=["response"])
518
519 assert cast(Any, response.is_closed) is True
520
521 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
522 @parametrize
523 async def test_path_params_list(self, async_client: AsyncAnthropic) -> None:
524 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
525 await async_client.beta.sessions.resources.with_raw_response.list(
526 session_id="",
527 )
528
529 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
530 @parametrize
531 async def test_method_delete(self, async_client: AsyncAnthropic) -> None:
532 resource = await async_client.beta.sessions.resources.delete(
533 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
534 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
535 )
536 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
537
538 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
539 @parametrize
540 async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None:
541 resource = await async_client.beta.sessions.resources.delete(
542 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
543 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
544 betas=["message-batches-2024-09-24"],
545 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
546 )
547 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
548
549 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
550 @parametrize
551 async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None:
552 response = await async_client.beta.sessions.resources.with_raw_response.delete(
553 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
554 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
555 )
556
557 assert response.is_closed is True
558 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
559 resource = await response.parse()
560 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
561
562 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
563 @parametrize
564 async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> None:
565 async with async_client.beta.sessions.resources.with_streaming_response.delete(
566 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
567 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
568 ) as response:
569 assert not response.is_closed
570 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
571
572 resource = await response.parse()
573 assert_matches_type(BetaManagedAgentsDeleteSessionResource, resource, path=["response"])
574
575 assert cast(Any, response.is_closed) is True
576
577 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
578 @parametrize
579 async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None:
580 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
581 await async_client.beta.sessions.resources.with_raw_response.delete(
582 resource_id="sesrsc_011CZkZBJq5dWxk9fVLNcPht",
583 session_id="",
584 )
585
586 with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_id` but received ''"):
587 await async_client.beta.sessions.resources.with_raw_response.delete(
588 resource_id="",
589 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
590 )
591
592 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
593 @parametrize
594 async def test_method_add(self, async_client: AsyncAnthropic) -> None:
595 resource = await async_client.beta.sessions.resources.add(
596 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
597 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
598 type="file",
599 )
600 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
601
602 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
603 @parametrize
604 async def test_method_add_with_all_params(self, async_client: AsyncAnthropic) -> None:
605 resource = await async_client.beta.sessions.resources.add(
606 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
607 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
608 type="file",
609 mount_path="/uploads/receipt.pdf",
610 betas=["message-batches-2024-09-24"],
611 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
612 )
613 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
614
615 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
616 @parametrize
617 async def test_raw_response_add(self, async_client: AsyncAnthropic) -> None:
618 response = await async_client.beta.sessions.resources.with_raw_response.add(
619 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
620 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
621 type="file",
622 )
623
624 assert response.is_closed is True
625 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
626 resource = await response.parse()
627 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
628
629 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
630 @parametrize
631 async def test_streaming_response_add(self, async_client: AsyncAnthropic) -> None:
632 async with async_client.beta.sessions.resources.with_streaming_response.add(
633 session_id="sesn_011CZkZAtmR3yMPDzynEDxu7",
634 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
635 type="file",
636 ) as response:
637 assert not response.is_closed
638 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
639
640 resource = await response.parse()
641 assert_matches_type(BetaManagedAgentsFileResource, resource, path=["response"])
642
643 assert cast(Any, response.is_closed) is True
644
645 @pytest.mark.skip(reason="prism can't find endpoint with beta only tag")
646 @parametrize
647 async def test_path_params_add(self, async_client: AsyncAnthropic) -> None:
648 with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
649 await async_client.beta.sessions.resources.with_raw_response.add(
650 session_id="",
651 file_id="file_011CNha8iCJcU1wXNR6q4V8w",
652 type="file",
653 )