code: def test_remote_default(dvc):
      remote_name = "drive"
      remote_url = "gdrive://test/test"
      new_name = "new"
      # prepare
      assert main(["remote", "add", "-d", remote_name, remote_url]) == 0
      assert main(["remote", "default", "--local", remote_name]) == 0
      config = dvc.config.load_one("repo")
      assert config["core"]["remote"] == remote_name
      assert config["remote"][remote_name]["url"] == remote_url
      assert new_name not in config.get("remote", {})
      local_config = dvc.config.load_one("local")
      assert local_config["core"]["remote"] == remote_name
  
      # rename success
      assert main(["remote", "rename", remote_name, new_name]) == 0
      config = dvc.config.load_one("repo")
      assert remote_name not in config.get("remote", {})
      assert config["core"]["remote"] == new_name
      assert config["remote"][new_name]["url"] == remote_url
      assert remote_name not in config.get("remote", {})
      local_config = dvc.config.load_one("local")
      assert local_config["core"]["remote"] == new_name
  
imports: import errno
  import itertools
  import os
  import stat
  import configobj
  import pytest
  from dvc.cli import main
  from dvc.config import Config
  from dvc.exceptions import DownloadError, UploadError
  from dvc.utils.fs import remove
label_desc: Use image node_id 21 for calling a global function with example usage: test_remote_default(dvc) without return types