From 2b8e90d8fd962ba3ca30e67e3ce060cddc6791d2 Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Wed, 15 Apr 2026 18:43:25 +0000 Subject: [PATCH] test(config): cover LM Studio nullable api key --- tests/cli/test_commands.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/cli/test_commands.py b/tests/cli/test_commands.py index e4edfaf8..a2199195 100644 --- a/tests/cli/test_commands.py +++ b/tests/cli/test_commands.py @@ -257,6 +257,28 @@ def test_config_accepts_camel_case_explicit_provider_name_for_coding_plan(): assert config.get_api_base() == "https://ark.cn-beijing.volces.com/api/coding/v3" +def test_config_accepts_lm_studio_without_api_key_and_uses_default_localhost_api_base(): + config = Config.model_validate( + { + "agents": { + "defaults": { + "provider": "lm_studio", + "model": "local-model", + } + }, + "providers": { + "lmStudio": { + "apiKey": None, + } + }, + } + ) + + assert config.get_provider_name() == "lm_studio" + assert config.get_api_key() is None + assert config.get_api_base() == "http://localhost:1234/v1" + + def test_find_by_name_accepts_camel_case_and_hyphen_aliases(): assert find_by_name("volcengineCodingPlan") is not None assert find_by_name("volcengineCodingPlan").name == "volcengine_coding_plan"