diff --git a/tests/basic/test_repo.py b/tests/basic/test_repo.py index 92d074b9a..ad727b24b 100644 --- a/tests/basic/test_repo.py +++ b/tests/basic/test_repo.py @@ -107,14 +107,24 @@ class TestRepo(unittest.TestCase): @patch("aider.repo.simple_send_with_retries") def test_get_commit_message(self, mock_send): - mock_send.return_value = "a good commit message" + mock_send.side_effect = ["", "a good commit message"] - repo = GitRepo(InputOutput(), None, None, models=[self.GPT35]) + model1 = Model("gpt-3.5-turbo") + model2 = Model("gpt-4") + repo = GitRepo(InputOutput(), None, None, models=[model1, model2]) + # Call the get_commit_message method with dummy diff and context result = repo.get_commit_message("dummy diff", "dummy context") - # Assert that the returned message is the expected one + # Assert that the returned message is the expected one from the second model self.assertEqual(result, "a good commit message") + + # Check that simple_send_with_retries was called twice + self.assertEqual(mock_send.call_count, 2) + + # Check that it was called with the correct model names + mock_send.assert_any_call(model1.name, mock_send.call_args[0][1]) + mock_send.assert_any_call(model2.name, mock_send.call_args[0][1]) @patch("aider.repo.simple_send_with_retries") def test_get_commit_message_strip_quotes(self, mock_send):