diff --git a/tests/func/test_remote.py b/tests/func/test_remote.py index 8f9d12b9f..7639d6b88 100644 --- a/tests/func/test_remote.py +++ b/tests/func/test_remote.py @@ -260,7 +260,7 @@ def test_modify_missing_remote(dvc): remote_config.modify("myremote", "gdrive_client_id", "xxx") -def test_verify_checksums(tmp_dir, tmp_path_factory, erepo_dir, mocker): +def test_verify_checksums(tmp_dir, erepo_dir, mocker): with erepo_dir.chdir(): erepo_dir.dvc_gen({"file": "file1 content"}, commit="add file") erepo_dir.dvc_gen( @@ -283,4 +283,3 @@ def test_verify_checksums(tmp_dir, tmp_path_factory, erepo_dir, mocker): dvc.pull(verify=True) assert file_md5_spy.call_count == 3 - pass diff --git a/tests/unit/command/test_data_sync.py b/tests/unit/command/test_data_sync.py new file mode 100644 index 000000000..8565c2e83 --- /dev/null +++ b/tests/unit/command/test_data_sync.py @@ -0,0 +1,74 @@ +from dvc.cli import parse_args +from dvc.command.data_sync import CmdDataFetch, CmdDataPull + + +def test_fetch(mocker): + cli_args = parse_args( + [ + "fetch", + "target.dvc", + "-r", + "remote", + "-a", + "-T", + "-d", + "-R", + "--verify", + "-j", + "2", + ] + ) + assert cli_args.func == CmdDataFetch + + cmd = cli_args.func(cli_args) + m = mocker.patch("dvc.repo.Repo.fetch") + + assert cmd.run() == 0 + + m.assert_called_once_with( + targets=["target.dvc"], + remote="remote", + all_branches=True, + all_tags=True, + with_deps=True, + recursive=True, + verify=True, + jobs=2, + ) + + +def test_pull(mocker): + cli_args = parse_args( + [ + "pull", + "target.dvc", + "-r", + "remote", + "-a", + "-T", + "-d", + "-R", + "-f", + "--verify", + "-j", + "2", + ] + ) + assert cli_args.func == CmdDataPull + + cmd = cli_args.func(cli_args) + m = mocker.patch("dvc.repo.Repo.pull") + + assert cmd.run() == 0 + + m.assert_called_once_with( + targets=["target.dvc"], + remote="remote", + all_branches=True, + all_tags=True, + with_deps=True, + recursive=True, + force=True, + verify=True, + jobs=2, + )