@@ -248,39 +248,31 @@ async def test_should_not_throw_when_disposing_session_after_stopping_client(sel
248248 await client .force_stop ()
249249
250250 @pytest .mark .asyncio
251- async def test_should_throw_when_create_session_called_without_permission_handler (self ):
252- """`create_session` requires an `on_permission_request` handler."""
251+ async def test_should_create_session_without_permission_handler (self ):
252+ """`create_session` allows omitting an `on_permission_request` handler."""
253253 client = CopilotClient (SubprocessConfig (cli_path = CLI_PATH , use_stdio = True ))
254254
255255 try :
256256 await client .start ()
257- with pytest .raises ((TypeError , ValueError )) as exc_info :
258- await client .create_session () # type: ignore[call-arg]
257+ session = await client .create_session ()
259258
260- message = str (exc_info .value )
261- # Accept either 'on_permission_request' missing-arg or runtime validation error.
262- assert "on_permission_request" in message or "permission" in message .lower (), (
263- f"Expected message to reference permission handler, got: { message } "
264- )
259+ assert session .session_id
265260
266261 await client .stop ()
267262 finally :
268263 await client .force_stop ()
269264
270265 @pytest .mark .asyncio
271- async def test_should_throw_when_resume_session_called_without_permission_handler (self ):
272- """`resume_session` requires an `on_permission_request` handler."""
266+ async def test_should_resume_session_without_permission_handler (self ):
267+ """`resume_session` allows omitting an `on_permission_request` handler."""
273268 client = CopilotClient (SubprocessConfig (cli_path = CLI_PATH , use_stdio = True ))
274269
275270 try :
276271 await client .start ()
277- with pytest . raises (( TypeError , ValueError )) as exc_info :
278- await client .resume_session ("some- session-id" ) # type: ignore[call-arg]
272+ session = await client . create_session ()
273+ resumed = await client .resume_session (session . session_id )
279274
280- message = str (exc_info .value )
281- assert "on_permission_request" in message or "permission" in message .lower (), (
282- f"Expected message to reference permission handler, got: { message } "
283- )
275+ assert resumed .session_id == session .session_id
284276
285277 await client .stop ()
286278 finally :
0 commit comments