Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a6fdd4

Browse files
committed
Add test for pushing to unrelated upstream
1 parent 1bfd108 commit 4a6fdd4

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/commands/install_uninstall_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,23 @@ def test_pre_push_integration_accepted(tempdir_factory):
564564
assert 'Passed' in output
565565

566566

567+
def test_pre_push_new_upstream(tempdir_factory):
568+
upstream = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
569+
upstream2 = git_dir(tempdir_factory)
570+
path = tempdir_factory.get()
571+
cmd_output('git', 'clone', upstream, path)
572+
with cwd(path):
573+
install(Runner(path, C.CONFIG_FILE), hook_type='pre-push')
574+
assert _get_commit_output(tempdir_factory)[0] == 0
575+
576+
cmd_output('git', 'remote', 'rename', 'origin', 'upstream')
577+
cmd_output('git', 'remote', 'add', 'origin', upstream2)
578+
retc, output = _get_push_output(tempdir_factory)
579+
assert retc == 0
580+
assert 'Bash hook' in output
581+
assert 'Passed' in output
582+
583+
567584
def test_pre_push_integration_empty_push(tempdir_factory):
568585
upstream = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
569586
path = tempdir_factory.get()

0 commit comments

Comments
 (0)