code: def test_add_to_remote(self, tmp_dir, dvc, remote, workspace):
      workspace.gen("foo", "foo")
  
      url = "remote://workspace/foo"
      [stage] = dvc.add(url, to_remote=True)
  
      assert not (tmp_dir / "foo").exists()
      assert (tmp_dir / "foo.dvc").exists()
  
      assert len(stage.deps) == 0
      assert len(stage.outs) == 1
  
      hash_info = stage.outs[0].hash_info
      meta = stage.outs[0].meta
      assert hash_info.name == "md5"
      assert hash_info.value == "acbd18db4cc2f85cedef654fccc4a4d8"
      assert (
          remote
          / "files"
          / "md5"
          / "ac"
          / "bd18db4cc2f85cedef654fccc4a4d8"
      ).read_text() == "foo"
      assert meta.size == len("foo")
  
imports: import os
  from typing import Dict, Union
  import pytest
  from funcy import first
  from dvc.exceptions import URLMissingError
  from dvc.repo import Repo
  from dvc.repo.ls_url import ls_url, parse_external_url
  from dvc.utils.fs import remove
label_desc: Use image node_id 1 for calling the TestToRemote obj's underlying member method code with example usage: obj.test_add_to_remote(tmp_dir, dvc, remote, workspace) without return types