e2e: Add test case for invalid tracks

This commit is contained in:
2022-06-23 19:15:52 +02:00
parent eac22148c5
commit 09ce9f043e

View File

@@ -114,6 +114,16 @@ def test_worktree_add_invalid_name():
assert "invalid worktree name" in str(cmd.stderr.lower())
def test_worktree_add_invalid_track():
with TempGitRepositoryWorktree.get(funcname()) as (base_dir, _commit):
for track in ["/absolute/path", "trailingslash/", "/"]:
args = ["wt", "add", "foo", "--track", track]
cmd = grm(args, cwd=base_dir)
assert cmd.returncode != 0
assert len(cmd.stderr.strip().split("\n")) == 1
assert not os.path.exists("foo")
assert not os.path.exists(os.path.join(base_dir, "foo"))
assert "tracking branch" in str(cmd.stderr.lower())
@pytest.mark.parametrize("remote_branch_already_exists", [True, False])