def test_remove_command(): remove = commands.remove(test_context, ["myfile"]) assert not remove.reads_remote assert not remove.writes_remote assert remove.targets == ["myfile"] assert str(remove) == "remove myfile" try: remove = commands.remove(test_context, []) assert False, "Expected an error for remove without a file" except UVCError: pass
def test_remove_command_no_targets(): myfile = path(topdir) / "myfile" myfile.write_bytes("test data") try: generic_remove = commands.remove(context, ["myfile"]) remove = hg.remove(generic_remove) finally: myfile.unlink() assert not remove.reads_remote assert not remove.writes_remote assert remove.get_command_line() == ["hg", "remove", "-f", "myfile"]
def test_remove_is_secured(): try: remove = commands.remove(secure_context, [topdir / ".." / "foo"]) assert False, "Expected exception for going above topdir" except commands.SecurityError: pass