def test_revert_command(): revert = commands.revert(test_context, ["myfile"]) assert not revert.reads_remote assert not revert.writes_remote assert revert.targets == ["myfile"] assert str(revert) == "revert myfile" revert = commands.revert(test_context, []) assert revert.targets == None assert str(revert) == "revert"
def test_revert_all_files(): testfile = topdir / "foo.txt" testfile.write_text("Test text") try: generic_revert = commands.revert(context, []) result = dialect.convert(generic_revert) assert result.get_command_line() == ["svn", "revert", "-R", "foo.txt"] finally: testfile.unlink()
def test_revert_command(): myfile = path(topdir) / "myfile" myfile.write_bytes("test data") try: generic_revert = commands.revert(context, []) revert = hg.revert(generic_revert) finally: myfile.unlink() assert not revert.reads_remote assert not revert.writes_remote assert revert.get_command_line() == ["hg", "revert", "--no-backup", "-a"]
def test_revert_is_secured(): try: revert = commands.revert(secure_context, [topdir / ".." / "foo"]) assert False, "Expected exception for going above topdir" except commands.SecurityError: pass