Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions python/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,44 @@ async def mock_request(method, params):
assert captured["session.model.switchTo"]["modelId"] == "gpt-4.1"
finally:
await client.force_stop()

@pytest.mark.asyncio
async def test_create_session_exposes_workspace_path(self):
client = CopilotClient({"cli_path": CLI_PATH})
await client.start()

try:
session = await client.create_session(
{"on_permission_request": PermissionHandler.approve_all}
)
assert session.workspace_path is not None
assert session.workspace_path.endswith(session.session_id)
finally:
await client.force_stop()

@pytest.mark.asyncio
async def test_destroy_warns_and_disconnects_session(self):
client = CopilotClient({"cli_path": CLI_PATH})
await client.start()

try:
session = await client.create_session(
{"on_permission_request": PermissionHandler.approve_all}
)

captured = {}
original_request = client._client.request

async def mock_request(method, params):
captured[method] = params
if method == "session.destroy":
return {}
return await original_request(method, params)

client._client.request = mock_request
with pytest.deprecated_call(match=r"destroy\(\) is deprecated, use disconnect\(\) instead"):
await session.destroy()

assert captured["session.destroy"] == {"sessionId": session.session_id}
finally:
await client.force_stop()