Esempio n. 1
0
def test_quit_early_if_bad_baseline():
    with pytest.raises(SystemExit):
        main(['test_data/files/file_with_secrets.py', '--baseline', 'does-not-exist'])
Esempio n. 2
0
def assert_commit_result(command, return_code):
    assert pre_commit_hook.main(command.split()) == return_code
Esempio n. 3
0
def assert_commit_blocked(command: List[str]):
    assert main(command) == 1
Esempio n. 4
0
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
Esempio n. 6
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
Esempio n. 9
0
def assert_commit_succeeds(command):
    assert main(command.split()) == 0
Esempio n. 10
0
def assert_commit_blocked(command):
    assert main(command.split()) == 1
Esempio n. 11
0
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())
def assert_commit_succeeds(command):
    assert pre_commit_hook.main(command.split()) == 0
def assert_commit_blocked(command):
    assert pre_commit_hook.main(command.split()) == 1