test_copilot_in_model_list.py
1 """Tests for GitHub Copilot entries shown in the /model picker.""" 2 3 import os 4 from unittest.mock import patch 5 6 from hermes_cli.model_switch import list_authenticated_providers 7 8 9 @patch.dict(os.environ, {"GH_TOKEN": "test-key"}, clear=False) 10 def test_copilot_picker_keeps_curated_copilot_models_when_live_catalog_unavailable(): 11 with patch("agent.models_dev.fetch_models_dev", return_value={}), \ 12 patch("hermes_cli.models._resolve_copilot_catalog_api_key", return_value="gh-token"), \ 13 patch("hermes_cli.models._fetch_github_models", return_value=None): 14 providers = list_authenticated_providers(current_provider="openrouter", max_models=50) 15 16 copilot = next((p for p in providers if p["slug"] == "copilot"), None) 17 18 assert copilot is not None 19 assert "gpt-5.4" in copilot["models"] 20 assert "claude-sonnet-4.6" in copilot["models"] 21 assert "claude-sonnet-4" in copilot["models"] 22 assert "claude-sonnet-4.5" in copilot["models"] 23 assert "claude-haiku-4.5" in copilot["models"] 24 assert "gemini-3.1-pro-preview" in copilot["models"] 25 assert "claude-opus-4.6" not in copilot["models"] 26 27 28 @patch.dict(os.environ, {"GH_TOKEN": "test-key"}, clear=False) 29 def test_copilot_picker_uses_live_catalog_when_available(): 30 live_models = ["gpt-5.4", "claude-sonnet-4.6", "gemini-3.1-pro-preview"] 31 32 with patch("agent.models_dev.fetch_models_dev", return_value={}), \ 33 patch("hermes_cli.models._resolve_copilot_catalog_api_key", return_value="gh-token"), \ 34 patch("hermes_cli.models._fetch_github_models", return_value=live_models): 35 providers = list_authenticated_providers(current_provider="openrouter", max_models=50) 36 37 copilot = next((p for p in providers if p["slug"] == "copilot"), None) 38 39 assert copilot is not None 40 assert copilot["models"] == live_models 41 assert copilot["total_models"] == len(live_models)