fix(litellm): gate OAuth routes on real credentials

This commit is contained in:
Codex
2026-10-08 21:43:18 -07:00
parent 9a4020b7ec
commit 6473297555
4 changed files with 33 additions and 5 deletions
+12 -1
View File
@@ -1,5 +1,7 @@
import unittest
from render_config import build_config
from pathlib import Path
from tempfile import TemporaryDirectory
from render_config import build_config, oauth_ready
class ConfigTests(unittest.TestCase):
@@ -33,6 +35,15 @@ class ConfigTests(unittest.TestCase):
self.assertTrue(routes[0]['litellm_params']['use_xai_oauth'])
self.assertNotIn('api_key', routes[0]['litellm_params'])
def test_pending_oauth_is_not_ready(self):
with TemporaryDirectory() as folder:
path = Path(folder) / 'auth.json'
self.assertFalse(oauth_ready(path))
path.write_text('{"device_code_requested_at": 1}')
self.assertFalse(oauth_ready(path))
path.write_text('{"access_token": "fixture-only"}')
self.assertTrue(oauth_ready(path))
if __name__ == '__main__':
unittest.main()