import unittest.mock
from unittest.mock import patch, MagicMock
from src import ai_client

def test_minimax_model_selection() -> None:
 ai_client.set_provider("minimax", "MiniMax-M2.5")
 assert ai_client._provider == "minimax"
 assert ai_client._model == "MiniMax-M2.5"

def test_minimax_default_model() -> None:
 ai_client.set_provider("minimax", "invalid-model")
 assert ai_client._model == "MiniMax-M2.5"

def test_minimax_list_models() -> None:
 models = ai_client.list_models("minimax")
 assert "MiniMax-M2.5" in models
 assert "MiniMax-M2.5-highspeed" in models
 assert "MiniMax-M2.1" in models
 assert "MiniMax-M2" in models

def test_minimax_history_bleed_stats() -> None:
 ai_client.set_provider("minimax", "MiniMax-M2.5")
 ai_client.reset_session()
 stats = ai_client.get_history_bleed_stats(md_content="Test context")
 assert stats["provider"] == "minimax"
 assert stats["limit"] == 204800

def test_minimax_in_providers_list() -> None:
 from src.gui_2 import PROVIDERS
 assert "minimax" in PROVIDERS

def test_minimax_in_app_controller_providers() -> None:
 from src.app_controller import AppController
 assert "minimax" in AppController.PROVIDERS

def test_minimax_credentials_template() -> None:
 try:
  ai_client._load_credentials()
 except FileNotFoundError as e:
  error_msg = str(e)
  assert "minimax" in error_msg
