23
23
24
24
from codex import Codex , AsyncCodex , APIResponseValidationError
25
25
from codex ._types import Omit
26
+ from codex ._utils import maybe_transform
26
27
from codex ._models import BaseModel , FinalRequestOptions
27
28
from codex ._constants import RAW_RESPONSE_HEADER
28
29
from codex ._exceptions import APIStatusError , APITimeoutError , APIResponseValidationError
29
30
from codex ._base_client import DEFAULT_TIMEOUT , HTTPX_DEFAULT_TIMEOUT , BaseClient , make_request_options
31
+ from codex .types .project_create_params import ProjectCreateParams
30
32
31
33
from .utils import update_env
32
34
@@ -680,7 +682,13 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
680
682
with pytest .raises (APITimeoutError ):
681
683
self .client .post (
682
684
"/api/projects/" ,
683
- body = cast (object , dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" )),
685
+ body = cast (
686
+ object ,
687
+ maybe_transform (
688
+ dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ),
689
+ ProjectCreateParams ,
690
+ ),
691
+ ),
684
692
cast_to = httpx .Response ,
685
693
options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
686
694
)
@@ -695,7 +703,13 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
695
703
with pytest .raises (APIStatusError ):
696
704
self .client .post (
697
705
"/api/projects/" ,
698
- body = cast (object , dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" )),
706
+ body = cast (
707
+ object ,
708
+ maybe_transform (
709
+ dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ),
710
+ ProjectCreateParams ,
711
+ ),
712
+ ),
699
713
cast_to = httpx .Response ,
700
714
options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
701
715
)
@@ -1425,7 +1439,13 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
1425
1439
with pytest .raises (APITimeoutError ):
1426
1440
await self .client .post (
1427
1441
"/api/projects/" ,
1428
- body = cast (object , dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" )),
1442
+ body = cast (
1443
+ object ,
1444
+ maybe_transform (
1445
+ dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ),
1446
+ ProjectCreateParams ,
1447
+ ),
1448
+ ),
1429
1449
cast_to = httpx .Response ,
1430
1450
options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
1431
1451
)
@@ -1440,7 +1460,13 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
1440
1460
with pytest .raises (APIStatusError ):
1441
1461
await self .client .post (
1442
1462
"/api/projects/" ,
1443
- body = cast (object , dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" )),
1463
+ body = cast (
1464
+ object ,
1465
+ maybe_transform (
1466
+ dict (config = {}, name = "name" , organization_id = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ),
1467
+ ProjectCreateParams ,
1468
+ ),
1469
+ ),
1444
1470
cast_to = httpx .Response ,
1445
1471
options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
1446
1472
)
0 commit comments