Files
dvc/tests/unit/command/test_update.py
T
Saugat Pachhai 46e5053705 update: support specifying revision when updating (#3337)
* update: work with rev

* completion: update --rev completion scripts

* test: fix unit test assumption

* test: use fspath_py35
2020-02-15 17:55:41 +02:00

20 lines
566 B
Python

import pytest
from dvc.cli import parse_args
from dvc.command.update import CmdUpdate
@pytest.mark.parametrize(
"command,rev", [(["update"], None), (["update", "--rev", "REV"], "REV")]
)
def test_update(dvc, mocker, command, rev):
targets = ["target1", "target2", "target3"]
cli_args = parse_args(command + targets)
assert cli_args.func == CmdUpdate
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.Repo.update")
assert cmd.run() == 0
calls = [mocker.call(target, rev) for target in targets]
m.assert_has_calls(calls)