Files
my-pal-mcp-server/tests/test_clink_integration.py
Fahad 9ffca53ce5 feat! Claude Code as a CLI agent now supported. Mix and match: spawn claude code from within claude code, or claude code from within codex.
Stay in codex, plan review and fix complicated bugs, then ask it to spawn claude code and implement the plan.

This uses your current subscription instead of API tokens.
2025-10-08 11:14:22 +04:00

81 lines
2.4 KiB
Python

import json
import os
import shutil
import pytest
from tools.clink import CLinkTool
@pytest.mark.integration
@pytest.mark.asyncio
async def test_clink_gemini_single_digit_sum():
if shutil.which("gemini") is None:
pytest.skip("gemini CLI is not installed or on PATH")
if not (os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")):
pytest.skip("Gemini API key is not configured")
tool = CLinkTool()
prompt = "Respond with a single digit equal to the sum of 2 + 2. Output only that digit."
results = await tool.execute(
{
"prompt": prompt,
"cli_name": "gemini",
"role": "default",
"files": [],
"images": [],
}
)
assert results, "clink tool returned no outputs"
payload = json.loads(results[0].text)
status = payload["status"]
assert status in {"success", "continuation_available"}
content = payload.get("content", "").strip()
assert content == "4"
if status == "continuation_available":
offer = payload.get("continuation_offer") or {}
assert offer.get("continuation_id"), "Expected continuation metadata when status indicates availability"
@pytest.mark.integration
@pytest.mark.asyncio
async def test_clink_claude_single_digit_sum():
if shutil.which("claude") is None:
pytest.skip("claude CLI is not installed or on PATH")
tool = CLinkTool()
prompt = "Respond with a single digit equal to the sum of 2 + 2. Output only that digit."
results = await tool.execute(
{
"prompt": prompt,
"cli_name": "claude",
"role": "default",
"files": [],
"images": [],
}
)
assert results, "clink tool returned no outputs"
payload = json.loads(results[0].text)
status = payload["status"]
if status == "error":
metadata = payload.get("metadata") or {}
reason = payload.get("content") or metadata.get("message") or "Claude CLI reported an error"
pytest.skip(f"Skipping Claude integration test: {reason}")
assert status in {"success", "continuation_available"}
content = payload.get("content", "").strip()
assert content == "4"
if status == "continuation_available":
offer = payload.get("continuation_offer") or {}
assert offer.get("continuation_id"), "Expected continuation metadata when status indicates availability"