77 FleetApi ,
88 Mode ,
99 ModeApi ,
10+ ModelsApi ,
11+ PlanApi ,
1012 SessionFleetStartParams ,
1113 SessionModeSetParams ,
1214)
1315
1416
1517class TestRpcTimeout :
18+ """Tests for timeout forwarding across all four codegen branches:
19+ - session-scoped with params
20+ - session-scoped without params
21+ - server-scoped with params (not tested — no server+params method exists yet)
22+ - server-scoped without params
23+ """
24+
25+ # ── session-scoped, with params ──────────────────────────────────
26+
1627 @pytest .mark .asyncio
1728 async def test_default_timeout_not_forwarded (self ):
1829 client = AsyncMock ()
@@ -37,7 +48,7 @@ async def test_custom_timeout_forwarded(self):
3748 assert kwargs ["timeout" ] == 600.0
3849
3950 @pytest .mark .asyncio
40- async def test_timeout_on_other_methods (self ):
51+ async def test_timeout_on_session_params_method (self ):
4152 client = AsyncMock ()
4253 client .request = AsyncMock (return_value = {"mode" : "plan" })
4354 api = ModeApi (client , "sess-1" )
@@ -46,3 +57,51 @@ async def test_timeout_on_other_methods(self):
4657
4758 _ , kwargs = client .request .call_args
4859 assert kwargs ["timeout" ] == 120.0
60+
61+ # ── session-scoped, no params ────────────────────────────────────
62+
63+ @pytest .mark .asyncio
64+ async def test_timeout_on_session_no_params_method (self ):
65+ client = AsyncMock ()
66+ client .request = AsyncMock (return_value = {"exists" : True })
67+ api = PlanApi (client , "sess-1" )
68+
69+ await api .read (timeout = 90.0 )
70+
71+ _ , kwargs = client .request .call_args
72+ assert kwargs ["timeout" ] == 90.0
73+
74+ @pytest .mark .asyncio
75+ async def test_default_timeout_on_session_no_params_method (self ):
76+ client = AsyncMock ()
77+ client .request = AsyncMock (return_value = {"exists" : True })
78+ api = PlanApi (client , "sess-1" )
79+
80+ await api .read ()
81+
82+ _ , kwargs = client .request .call_args
83+ assert "timeout" not in kwargs
84+
85+ # ── server-scoped, no params ─────────────────────────────────────
86+
87+ @pytest .mark .asyncio
88+ async def test_timeout_on_server_no_params_method (self ):
89+ client = AsyncMock ()
90+ client .request = AsyncMock (return_value = {"models" : []})
91+ api = ModelsApi (client )
92+
93+ await api .list (timeout = 45.0 )
94+
95+ _ , kwargs = client .request .call_args
96+ assert kwargs ["timeout" ] == 45.0
97+
98+ @pytest .mark .asyncio
99+ async def test_default_timeout_on_server_no_params_method (self ):
100+ client = AsyncMock ()
101+ client .request = AsyncMock (return_value = {"models" : []})
102+ api = ModelsApi (client )
103+
104+ await api .list ()
105+
106+ _ , kwargs = client .request .call_args
107+ assert "timeout" not in kwargs
0 commit comments