From a41ad9e7788438df5146479f4c5269e4031453ea Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 27 Aug 2024 13:32:34 -0700 Subject: [PATCH] test: add tests for --suggest-shell-commands option --- tests/basic/test_main.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/basic/test_main.py b/tests/basic/test_main.py index 09ce68a82..c49b77927 100644 --- a/tests/basic/test_main.py +++ b/tests/basic/test_main.py @@ -599,3 +599,33 @@ class TestMain(TestCase): # shell commands require explicit approval, not just --yes self.assertFalse(Path("file.txt").exists()) + + def test_suggest_shell_commands_default(self): + with GitTemporaryDirectory(): + coder = main( + ["--exit", "--yes"], + input=DummyInput(), + output=DummyOutput(), + return_coder=True, + ) + self.assertTrue(coder.suggest_shell_commands) + + def test_suggest_shell_commands_disabled(self): + with GitTemporaryDirectory(): + coder = main( + ["--no-suggest-shell-commands", "--exit", "--yes"], + input=DummyInput(), + output=DummyOutput(), + return_coder=True, + ) + self.assertFalse(coder.suggest_shell_commands) + + def test_suggest_shell_commands_enabled(self): + with GitTemporaryDirectory(): + coder = main( + ["--suggest-shell-commands", "--exit", "--yes"], + input=DummyInput(), + output=DummyOutput(), + return_coder=True, + ) + self.assertTrue(coder.suggest_shell_commands)