"""Tests Spec 034 — KIMI LLM provider."""
from __future__ import annotations

import os
from unittest.mock import patch

from app.agents import llm_client


def test_resolve_provider_auto_kimi_when_key():
    with patch.dict(os.environ, {"AGENTIC_LLM_ENABLED": "true", "AGENTIC_LLM_PROVIDER": "auto", "KIMI_API_KEY": "sk-test"}, clear=False):
        import importlib
        importlib.reload(llm_client)
        assert llm_client.resolve_provider() == "kimi"


def test_clean_env_strips_inline_comment():
    assert llm_client._clean_env("kimi-k2.5                 # comment") == "kimi-k2.5"
    assert llm_client._clean_env("https://api.moonshot.ai/v1   # internacional") == "https://api.moonshot.ai/v1"


def test_llm_status_includes_provider():
    status = llm_client.llm_status()
    assert "provider" in status
    assert "model" in status
    assert "kimi_configured" in status
