diff --git a/tests/plugins/github/handlers/test_git_handler.py b/tests/plugins/github/handlers/test_git_handler.py index a8115577..179cb501 100644 --- a/tests/plugins/github/handlers/test_git_handler.py +++ b/tests/plugins/github/handlers/test_git_handler.py @@ -9,7 +9,9 @@ async def test_checkout_branch(mocker: MockerFixture): git_handler = GitHandler() git_handler.checkout_branch("main") - mock_run_shell_command.assert_called_once_with(["git", "checkout", "main"]) + mock_run_shell_command.assert_called_once_with( + ["git", "checkout", "main"], check=True, capture_output=True + ) async def test_checkout_remote_branch(mocker: MockerFixture): @@ -20,8 +22,12 @@ async def test_checkout_remote_branch(mocker: MockerFixture): git_handler = GitHandler() git_handler.checkout_remote_branch("main") - mock_run_shell_command.assert_any_call(["git", "fetch", "origin", "main"]) - mock_run_shell_command.assert_any_call(["git", "checkout", "main"]) + mock_run_shell_command.assert_any_call( + ["git", "fetch", "origin", "main"], check=True, capture_output=True + ) + mock_run_shell_command.assert_any_call( + ["git", "checkout", "main"], check=True, capture_output=True + ) async def test_commit_and_push(mocker: MockerFixture): @@ -33,16 +39,30 @@ async def test_commit_and_push(mocker: MockerFixture): git_handler.commit_and_push("commit message", "main", "author") mock_run_shell_command.assert_any_call( - ["git", "config", "--global", "user.name", "author"] + ["git", "config", "--global", "user.name", "author"], + check=True, + capture_output=True, + ) + mock_run_shell_command.assert_any_call( + ["git", "config", "--global", "user.email", "author@users.noreply.github.com"], + check=True, + capture_output=True, + ) + mock_run_shell_command.assert_any_call( + ["git", "add", "-A"], check=True, capture_output=True + ) + mock_run_shell_command.assert_any_call( + ["git", "commit", "-m", "commit message"], check=True, capture_output=True + ) + mock_run_shell_command.assert_any_call( + ["git", "fetch", "origin"], check=True, capture_output=True ) mock_run_shell_command.assert_any_call( - ["git", "config", "--global", "user.email", "author@users.noreply.github.com"] + ["git", "diff", "origin/main", "main"], check=True, capture_output=True + ) + mock_run_shell_command.assert_any_call( + ["git", "push", "origin", "main", "-f"], check=True, capture_output=True ) - mock_run_shell_command.assert_any_call(["git", "add", "-A"]) - mock_run_shell_command.assert_any_call(["git", "commit", "-m", "commit message"]) - mock_run_shell_command.assert_any_call(["git", "fetch", "origin"]) - mock_run_shell_command.assert_any_call(["git", "diff", "origin/main", "main"]) - mock_run_shell_command.assert_any_call(["git", "push", "origin", "main", "-f"]) async def test_delete_origin_branch(mocker: MockerFixture): @@ -54,7 +74,7 @@ async def test_delete_origin_branch(mocker: MockerFixture): git_handler.delete_origin_branch("main") mock_run_shell_command.assert_called_once_with( - ["git", "push", "origin", "--delete", "main"] + ["git", "push", "origin", "--delete", "main"], check=True, capture_output=True ) @@ -66,4 +86,6 @@ async def test_switch_branch(mocker: MockerFixture): git_handler = GitHandler() git_handler.switch_branch("main") - mock_run_shell_command.assert_called_once_with(["git", "switch", "-C", "main"]) + mock_run_shell_command.assert_called_once_with( + ["git", "switch", "-C", "main"], check=True, capture_output=True + )