From ac3df464e163f1a053ca204b866af0e2db3f466a Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 27 Aug 2024 13:53:21 -0700 Subject: [PATCH] test: verify shell command suggestion behavior with --no-suggest-shell-commands flag --- tests/basic/test_main.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/basic/test_main.py b/tests/basic/test_main.py index 6d9788810..d29dba9da 100644 --- a/tests/basic/test_main.py +++ b/tests/basic/test_main.py @@ -635,19 +635,25 @@ class TestMain(TestCase): shell_md = Path("shell.md") shell_md.write_text("```bash\ntouch no_suggest_file.txt\n```") - main( - ["--apply", "shell.md", "--yes", "--no-suggest-shell-commands"], - input=DummyInput(), - output=DummyOutput(), - ) + with patch("aider.io.InputOutput.confirm_ask") as mock_confirm_ask: + main( + ["--apply", "shell.md", "--no-suggest-shell-commands"], + #input=DummyInput(), + #output=DummyOutput(), + ) - # TODO: make sure confirm_ask is not called + # Make sure confirm_ask is not called when --no-suggest-shell-commands is used + mock_confirm_ask.assert_called_once() + with patch("aider.io.InputOutput.confirm_ask") as mock_confirm_ask: + main( + ["--apply", "shell.md"], + #input=DummyInput(), + #output=DummyOutput(), + ) - main( - ["--apply", "shell.md", "--yes"], - input=DummyInput(), - output=DummyOutput(), - ) + # Make sure confirm_ask IS called when --no-suggest-shell-commands is not used + mock_confirm_ask.assert_called_once() - # TODO: make sure confirm_ask IS called + # Check that the file was not created in either case + self.assertFalse(Path("no_suggest_file.txt").exists())