code: def test_cloud_cli(tmp_dir, dvc, remote, mocker):  # noqa: PLR0915
      jobs = 2
      args = ["-v", "-j", str(jobs)]
  
      (stage,) = tmp_dir.dvc_gen("foo", "foo")
      cache = stage.outs[0].cache_path
  
      (stage_dir,) = tmp_dir.dvc_gen(
          {
              "data_dir": {
                  "data_sub_dir": {"data_sub": "data_sub"},
                  "data": "data",
                  "empty": "",
              }
          }
      )
      assert stage_dir is not None
      cache_dir = stage_dir.outs[0].cache_path
  
      # FIXME check status output
      oids_exist = mocker.spy(LocalHashFileDB, "oids_exist")
  
      assert main(["push", *args]) == 0
      assert os.path.exists(cache)
      assert os.path.isfile(cache)
      assert os.path.isfile(cache_dir)
      assert oids_exist.called
      assert all(
          _kwargs["jobs"] == jobs
          for (_args, _kwargs) in oids_exist.call_args_list
      )
  
      dvc.cache.local.clear()
      oids_exist.reset_mock()
  
      assert main(["fetch", *args]) == 0
      assert os.path.exists(cache)
      assert os.path.isfile(cache)
      assert os.path.isfile(cache_dir)
      assert oids_exist.called
      assert all(
          _kwargs["jobs"] == jobs
          for (_args, _kwargs) in oids_exist.call_args_list
      )
  
      oids_exist.reset_mock()
  
      assert main(["pull", *args]) == 0
      assert os.path.exists(cache)
      assert os.path.isfile(cache)
      assert os.path.isfile(cache_dir)
      assert os.path.isfile("foo")
      assert os.path.isdir("data_dir")
      assert oids_exist.called
      assert all(
          _kwargs["jobs"] == jobs
          for (_args, _kwargs) in oids_exist.call_args_list
      )
  
      with open(cache, encoding="utf-8") as fd:
          assert fd.read() == "foo"
      assert os.path.isfile(cache_dir)
  
      # NOTE: http doesn't support gc yet
      if remote.url.startswith("http"):
          return
  
      oids_exist.reset_mock()
  
      _list_oids_traverse = mocker.spy(
          HashFileDB, "_list_oids_traverse"
      )
      # NOTE: check if remote gc works correctly on directories
      assert main(["gc", "-cw", "-f", *args]) == 0
      assert _list_oids_traverse.called
      assert all(
          _kwargs["jobs"] == 2
          for (_args, _kwargs) in oids_exist.call_args_list
      )
      shutil.move(dvc.cache.local.path, dvc.cache.local.path + ".back")
  
      assert main(["fetch", *args]) == 0
  
      assert oids_exist.called
      assert all(
          _kwargs["jobs"] == jobs
          for (_args, _kwargs) in oids_exist.call_args_list
      )
  
      oids_exist.reset_mock()
      assert main(["pull", "-f", *args]) == 0
      assert os.path.exists(cache)
      assert os.path.isfile(cache)
      assert os.path.isfile(cache_dir)
      assert os.path.isfile("foo")
      assert os.path.isdir("data_dir")
      assert oids_exist.called
      assert all(
          _kwargs["jobs"] == jobs
          for (_args, _kwargs) in oids_exist.call_args_list
      )
  
imports: import logging
  import os
  import shutil
  import pytest
  from flaky.flaky_decorator import flaky
  import dvc_data
  from dvc.cli import main
  from dvc.exceptions import CheckoutError
  from dvc.repo.open_repo import clean_repos
  from dvc.stage.exceptions import StageNotFound
  from dvc.testing.remote_tests import TestRemote
  from dvc.utils.fs import remove
  from dvc_data.hashfile.db import HashFileDB
  from dvc_data.hashfile.db.local import LocalHashFileDB
  from dvc_data.hashfile.hash_info import HashInfo
label_desc: Use image node_id 1 for calling a global function with example usage: test_cloud_cli(tmp_dir, dvc, remote, mocker) without return types