diff --git a/tests/test_main.py b/tests/test_main.py index c02204217..fc363ce5f 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -182,6 +182,20 @@ class TestMain(TestCase): _, kwargs = MockCoder.call_args assert kwargs["dirty_commits"] is True + @patch('aider.main.InputOutput.confirm_ask', return_value=True) + def test_message_file_flag(self, mock_confirm): + message_file_content = "This is a test message from a file." + message_file_path = "test_message.txt" + with open(message_file_path, 'w', encoding='utf-8') as message_file: + message_file.write(message_file_content) + + with patch("aider.main.Coder.create") as MockCoder: + MockCoder.return_value.run = MagicMock() + main(["--message-file", message_file_path], input=DummyInput(), output=DummyOutput()) + MockCoder.return_value.run.assert_called_once_with(with_message=message_file_content) + + os.remove(message_file_path) + def test_encodings_arg(self): fname = "foo.py"