From cca3c8a4a7b4464cf5b0108f3687b0c208deedd9 Mon Sep 17 00:00:00 2001 From: codgician <15964984+codgician@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:13:34 +0800 Subject: [PATCH] test(github-copilot): cover invalid legacy cache --- .../test_github_copilot_authenticator.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_litellm/llms/github_copilot/test_github_copilot_authenticator.py b/tests/test_litellm/llms/github_copilot/test_github_copilot_authenticator.py index 422b5e7dfbe..56c6dae4189 100644 --- a/tests/test_litellm/llms/github_copilot/test_github_copilot_authenticator.py +++ b/tests/test_litellm/llms/github_copilot/test_github_copilot_authenticator.py @@ -73,6 +73,17 @@ class TestGitHubCopilotAuthenticator: ): assert authenticator.get_api_base() == "https://api.enterprise.githubcopilot.com" + def test_get_api_base_ignores_invalid_legacy_cache(self, authenticator): + with ( + patch.dict(os.environ, {}, clear=True), + patch("builtins.open", mock_open(read_data="not-json")), + patch("litellm.llms.github_copilot.authenticator.verbose_logger.warning") as mock_warning, + ): + assert authenticator.get_api_base() is None + + assert mock_warning.call_count == 1 + assert "Error reading legacy GitHub Copilot API endpoint" in mock_warning.call_args.args[0] + def test_deprecated_api_key_url_warns(self): with ( patch.dict(