mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
test: mock and assert offer_openrouter_oauth call in no-key test
This commit is contained in:
parent
5b10af7b1a
commit
d2386bc1f6
1 changed files with 6 additions and 3 deletions
|
@ -1002,9 +1002,12 @@ class TestMain(TestCase):
|
|||
self.assertIn("gemini", coder.main_model.name.lower())
|
||||
del os.environ["GEMINI_API_KEY"]
|
||||
|
||||
# Test no API keys
|
||||
result = main(["--exit", "--yes"], input=DummyInput(), output=DummyOutput())
|
||||
self.assertEqual(result, 1)
|
||||
# Test no API keys - should offer OpenRouter OAuth
|
||||
with patch("aider.onboarding.offer_openrouter_oauth") as mock_offer_oauth:
|
||||
mock_offer_oauth.return_value = None # Simulate user declining or failure
|
||||
result = main(["--exit", "--yes"], input=DummyInput(), output=DummyOutput())
|
||||
self.assertEqual(result, 1) # Expect failure since no model could be selected
|
||||
mock_offer_oauth.assert_called_once()
|
||||
|
||||
def test_model_precedence(self):
|
||||
with GitTemporaryDirectory():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue