Exemplo 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'])
Exemplo n.º 2
0
def assert_commit_result(command, return_code):
    assert pre_commit_hook.main(command.split()) == return_code
Exemplo n.º 3
0
def assert_commit_blocked(command: List[str]):
    assert main(command) == 1
Exemplo 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
Exemplo 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
Exemplo n.º 9
0
def assert_commit_succeeds(command):
    assert main(command.split()) == 0
Exemplo n.º 10
0
def assert_commit_blocked(command):
    assert main(command.split()) == 1
Exemplo 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())
Exemplo n.º 12
0
def assert_commit_succeeds(command):
    assert pre_commit_hook.main(command.split()) == 0
Exemplo n.º 13
0
def assert_commit_blocked(command):
    assert pre_commit_hook.main(command.split()) == 1