def test_quit_early_if_bad_baseline(): with pytest.raises(SystemExit): main(['test_data/files/file_with_secrets.py', '--baseline', 'does-not-exist'])
def assert_commit_result(command, return_code): assert pre_commit_hook.main(command.split()) == return_code
def assert_commit_blocked(command: List[str]): assert main(command) == 1
def assert_commit_blocked_with_diff_exit_code(command: List[str]): assert main(command) == 3
def assert_commit_succeeds(command): assert pre_commit_hook.main(command.split()) == 0
def assert_commit_succeeds(command: List[str]): assert main(command) == 0
def assert_commit_blocked(command): assert pre_commit_hook.main(command.split()) == 1
def assert_commit_blocked_with_diff_exit_code(command): assert pre_commit_hook.main(command.split()) == 3
def assert_commit_succeeds(command): assert main(command.split()) == 0
def assert_commit_blocked(command): assert main(command.split()) == 1
def call_pre_commit_hook(command): with mock.patch( 'detect_secrets.pre_commit_hook.parse_args', return_value=parse_pre_commit_args_with_correct_prog(command), ): return pre_commit_hook.main(command.split())