Change-detectors, tautologies, source-reading tests, redundant duplicates, mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane ledger (category + reason for every removal).
119 lines
4.2 KiB
Python
119 lines
4.2 KiB
Python
"""Tests for Arcee AI provider support — standard direct API provider."""
|
|
|
|
import types
|
|
|
|
import pytest
|
|
|
|
from hermes_cli.auth import (
|
|
PROVIDER_REGISTRY,
|
|
resolve_provider,
|
|
get_api_key_provider_status,
|
|
resolve_api_key_provider_credentials,
|
|
)
|
|
|
|
|
|
_OTHER_PROVIDER_KEYS = (
|
|
"OPENAI_API_KEY", "ANTHROPIC_API_KEY", "DEEPSEEK_API_KEY",
|
|
"GOOGLE_API_KEY", "GEMINI_API_KEY", "DASHSCOPE_API_KEY",
|
|
"XAI_API_KEY", "KIMI_API_KEY", "KIMI_CN_API_KEY",
|
|
"MINIMAX_API_KEY", "MINIMAX_CN_API_KEY", "AI_GATEWAY_API_KEY",
|
|
"KILOCODE_API_KEY", "HF_TOKEN", "GLM_API_KEY", "ZAI_API_KEY",
|
|
"XIAOMI_API_KEY", "TOKENHUB_API_KEY", "COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN",
|
|
)
|
|
|
|
|
|
# =============================================================================
|
|
# Provider Registry
|
|
# =============================================================================
|
|
|
|
|
|
# =============================================================================
|
|
# Aliases
|
|
# =============================================================================
|
|
|
|
|
|
class TestArceeAliases:
|
|
@pytest.mark.parametrize("alias", ["arcee", "arcee-ai", "arceeai"])
|
|
def test_alias_resolves(self, alias, monkeypatch):
|
|
for key in _OTHER_PROVIDER_KEYS + ("OPENROUTER_API_KEY",):
|
|
monkeypatch.delenv(key, raising=False)
|
|
monkeypatch.setenv("ARCEEAI_API_KEY", "arc-test-12345")
|
|
assert resolve_provider(alias) == "arcee"
|
|
|
|
def test_normalize_provider_models_py(self):
|
|
from hermes_cli.models import normalize_provider
|
|
assert normalize_provider("arcee-ai") == "arcee"
|
|
assert normalize_provider("arceeai") == "arcee"
|
|
|
|
|
|
# =============================================================================
|
|
# Credentials
|
|
# =============================================================================
|
|
|
|
|
|
class TestArceeCredentials:
|
|
def test_status_configured(self, monkeypatch):
|
|
monkeypatch.setenv("ARCEEAI_API_KEY", "arc-test")
|
|
status = get_api_key_provider_status("arcee")
|
|
assert status["configured"]
|
|
|
|
|
|
def test_openrouter_key_does_not_make_arcee_configured(self, monkeypatch):
|
|
"""OpenRouter users should NOT see arcee as configured."""
|
|
monkeypatch.delenv("ARCEEAI_API_KEY", raising=False)
|
|
monkeypatch.setenv("OPENROUTER_API_KEY", "sk-or-test")
|
|
status = get_api_key_provider_status("arcee")
|
|
assert not status["configured"]
|
|
|
|
def test_resolve_credentials(self, monkeypatch):
|
|
monkeypatch.setenv("ARCEEAI_API_KEY", "arc-direct-key")
|
|
monkeypatch.delenv("ARCEE_BASE_URL", raising=False)
|
|
creds = resolve_api_key_provider_credentials("arcee")
|
|
assert creds["api_key"] == "arc-direct-key"
|
|
assert creds["base_url"] == PROVIDER_REGISTRY["arcee"].inference_base_url
|
|
|
|
|
|
# =============================================================================
|
|
# Model catalog
|
|
# =============================================================================
|
|
|
|
|
|
# =============================================================================
|
|
# Model normalization
|
|
# =============================================================================
|
|
|
|
|
|
class TestArceeNormalization:
|
|
|
|
|
|
def test_bare_name_unchanged(self):
|
|
from hermes_cli.model_normalize import normalize_model_for_provider
|
|
assert normalize_model_for_provider("trinity-mini", "arcee") == "trinity-mini"
|
|
|
|
|
|
# =============================================================================
|
|
# URL mapping
|
|
# =============================================================================
|
|
|
|
|
|
class TestArceeURLMapping:
|
|
|
|
|
|
def test_trajectory_compressor_detects_arcee(self):
|
|
import trajectory_compressor as tc
|
|
comp = tc.TrajectoryCompressor.__new__(tc.TrajectoryCompressor)
|
|
comp.config = types.SimpleNamespace(base_url="https://api.arcee.ai/api/v1")
|
|
assert comp._detect_provider() == "arcee"
|
|
|
|
|
|
# =============================================================================
|
|
# providers.py overlay + aliases
|
|
# =============================================================================
|
|
|
|
|
|
# =============================================================================
|
|
# Auxiliary client — main-model-first design
|
|
# =============================================================================
|
|
|
|
|