code: def test_initremote(store_path=None, store_url=None, ds_path=None):
      ds = Dataset(ds_path).create()
      store_path = Path(store_path)
      url = "ria+" + store_url
      init_opts = common_init_opts + ["url={}".format(url)]
  
      # fail when there's no RIA store at the destination
      assert_raises(
          CommandError,
          ds.repo.init_remote,
          "ora-remote",
          options=init_opts,
      )
      # Doesn't actually create a remote if it fails
      assert_not_in(
          "ora-remote",
          [
              cfg["name"]
              for uuid, cfg in ds.repo.get_special_remotes().items()
          ],
      )
  
      # now make it a store
      io = LocalIO()
      create_store(io, store_path, "1")
      create_ds_in_store(io, store_path, ds.id, "2", "1")
  
      # fails on non-RIA URL
      assert_raises(
          CommandError,
          ds.repo.init_remote,
          "ora-remote",
          options=common_init_opts
          + ["url={}" "".format(store_path.as_uri())],
      )
      # Doesn't actually create a remote if it fails
      assert_not_in(
          "ora-remote",
          [
              cfg["name"]
              for uuid, cfg in ds.repo.get_special_remotes().items()
          ],
      )
  
      ds.repo.init_remote("ora-remote", options=init_opts)
      assert_in(
          "ora-remote",
          [
              cfg["name"]
              for uuid, cfg in ds.repo.get_special_remotes().items()
          ],
      )
      assert_repo_status(ds.path)
      # git-annex:remote.log should have:
      #   - url
      #   - common_init_opts
      #   - archive_id (which equals ds id)
      remote_log = ds.repo.call_git(
          ["cat-file", "blob", "git-annex:remote.log"], read_only=True
      )
      assert_in("url={}".format(url), remote_log)
      [assert_in(c, remote_log) for c in common_init_opts]
      assert_in("archive-id={}".format(ds.id), remote_log)
  
file_path: datalad/datalad/distributed/tests/test_ora_http.py
imports: import shutil
  from datalad.api import Dataset
  from datalad.customremotes.ria_utils import create_ds_in_store, create_store
  from datalad.distributed.ora_remote import LocalIO
  from datalad.distributed.tests.ria_utils import common_init_opts, populate_dataset
  from datalad.support.exceptions import CommandError
  from datalad.tests.utils_pytest import assert_equal, assert_in, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, known_failure_windows, serve_path_via_http, skip_if_adjusted_branch, with_tempfile
  from datalad.utils import Path
label_desc: Use image node_id 1 for calling a global function with example usage: test_initremote(store_path, store_url, ds_path) without return types