Files
infra-docker-configs/servers/tools-pve/litellm/test_config.py
T

35 lines
1.5 KiB
Python

import unittest
from render_config import build_config
class ConfigTests(unittest.TestCase):
catalog = {
'zenmux': {'claude-sonnet-latest': 'anthropic/claude-sonnet-5.5'},
'openrouter': {'glm-latest': 'z-ai/glm-5.3-prime'},
'google_ai_studio': {'gemini-latest': 'gemini-test'},
'chatgpt': {'codex-latest': 'gpt-test'},
'xai': {'grok-latest': 'grok-test'},
}
def test_missing_credentials_exclude_routes(self):
self.assertEqual(build_config(self.catalog, {}, lambda _: False)['model_list'], [])
def test_subscription_preserves_vendor_prefix(self):
routes = build_config(self.catalog, {'ZENMUX_SUBSCRIPTION_API_KEY': 'secret'}, lambda _: False)['model_list']
self.assertEqual(routes[0]['litellm_params']['model'], 'anthropic/anthropic/claude-sonnet-5.5')
self.assertNotIn('secret', str(routes))
def test_payg_separate_alias(self):
routes = build_config(self.catalog, {'ZENMUX_PAYG_API_KEY': 'secret'}, lambda _: False)['model_list']
self.assertEqual(routes[0]['model_name'], 'claude-sonnet-latest-payg')
def test_oauth_requires_persistent_file(self):
routes = build_config(self.catalog, {}, lambda path: str(path) == '/tokens/xai/auth.json')['model_list']
self.assertEqual(len(routes), 1)
self.assertTrue(routes[0]['litellm_params']['use_xai_oauth'])
self.assertNotIn('api_key', routes[0]['litellm_params'])
if __name__ == '__main__':
unittest.main()