hermes-agent/tests/hermes_cli/test_xai_curated_models.py
teknium1 8f6109e493 test: purge low-value tests, lane py14 (360 removed)
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).
2026-09-23 03:15:26 -07:00

52 lines
1.7 KiB
Python

"""Regression tests for xAI curated + models.dev picker-time merge."""
from unittest.mock import patch
from hermes_cli.models import (
_PROVIDER_MODELS,
provider_model_ids,
)
def test_xai_oauth_picker_merges_models_dev_at_call_time():
"""xai-oauth must not return the import-frozen list; merge at picker time."""
top = _PROVIDER_MODELS["xai-oauth"][0]
mdev = ["grok-build-0.1", "grok-new-from-models-dev", top]
with patch("agent.models_dev.list_agentic_models", return_value=mdev) as mocked:
models = provider_model_ids("xai-oauth")
mocked.assert_called()
assert models[0] == top
assert "grok-new-from-models-dev" in models
def test_xai_api_key_picker_merges_models_dev_when_live_unavailable():
"""Without a live /v1/models hit, xai uses the models.dev preferred path."""
top = _PROVIDER_MODELS["xai-oauth"][0]
mdev = ["grok-build-0.1", "grok-new-from-models-dev", top]
with (
patch(
"hermes_cli.auth.resolve_api_key_provider_credentials",
side_effect=Exception("no key"),
),
patch("agent.models_dev.list_agentic_models", return_value=mdev) as mocked,
):
models = provider_model_ids("xai")
mocked.assert_called()
assert "grok-new-from-models-dev" in models
assert models[0] == top
def test_xai_pin_survives_when_top_model_only_in_extras():
"""If models.dev omits the curated top model, curated extras + finalize still pin it."""
top = _PROVIDER_MODELS["xai-oauth"][0]
mdev = ["grok-build-0.1", "grok-new-from-models-dev"]
with patch("agent.models_dev.list_agentic_models", return_value=mdev):
models = provider_model_ids("xai-oauth")
assert models[0] == top