Allow spaces in system hooks. Closes #95.

This commit is contained in:
Anthony Sottile 2014-05-18 14:20:11 -07:00
parent 53e316ade4
commit 61606cfaa4
5 changed files with 28 additions and 12 deletions

View file

@ -102,6 +102,11 @@ def failing_hook_repo(dummy_git_repo):
yield _make_repo(dummy_git_repo, 'failing_hook_repo')
@pytest.yield_fixture
def system_hook_with_spaces_repo(dummy_git_repo):
yield _make_repo(dummy_git_repo, 'system_hook_with_spaces_repo')
def _make_config(path, hook_id, file_regex):
config = {
'repo': path,
@ -138,6 +143,13 @@ def config_for_script_hooks_repo(script_hooks_repo):
yield _make_config(script_hooks_repo, 'bash_hook', '')
@pytest.yield_fixture
def config_for_system_hook_with_spaces(system_hook_with_spaces_repo):
yield _make_config(
system_hook_with_spaces_repo, 'system-hook-with-spaces', '',
)
def _make_repo_from_configs(*configs):
with open(C.CONFIG_FILE, 'w') as config_file:
yaml.dump(

View file

@ -40,6 +40,14 @@ def test_cwd_of_hook(config_for_prints_cwd_repo, store):
assert ret[1] == repo.repo_url + '\n'
@pytest.mark.integration
def test_system_hook_with_spaces(config_for_system_hook_with_spaces, store):
repo = Repository.create(config_for_system_hook_with_spaces, store)
ret = repo.run_hook('system-hook-with-spaces', [])
assert ret[0] == 0
assert ret[1] == 'Hello World\n'
@skipif_slowtests_false
@pytest.mark.integration
def test_run_a_node_hook(config_for_node_hooks_repo, store):