| 312 | |
| 313 | class TestToRemote: |
| 314 | def test_add_to_remote(self, tmp_dir, dvc, remote, workspace): |
| 315 | workspace.gen("foo", "foo") |
| 316 | |
| 317 | url = "remote://workspace/foo" |
| 318 | [stage] = dvc.add(url, to_remote=True) |
| 319 | |
| 320 | assert not (tmp_dir / "foo").exists() |
| 321 | assert (tmp_dir / "foo.dvc").exists() |
| 322 | |
| 323 | assert len(stage.deps) == 0 |
| 324 | assert len(stage.outs) == 1 |
| 325 | |
| 326 | hash_info = stage.outs[0].hash_info |
| 327 | meta = stage.outs[0].meta |
| 328 | assert hash_info.name == "md5" |
| 329 | assert hash_info.value == "acbd18db4cc2f85cedef654fccc4a4d8" |
| 330 | assert ( |
| 331 | remote / "files" / "md5" / "ac" / "bd18db4cc2f85cedef654fccc4a4d8" |
| 332 | ).read_text() == "foo" |
| 333 | assert meta.size == len("foo") |
| 334 | |
| 335 | def test_import_url_to_remote_file(self, tmp_dir, dvc, workspace, remote): |
| 336 | workspace.gen("foo", "foo") |