code: def test_url_keys(
      dspath=None, storepath=None, httppath=None, httpurl=None
  ):
      ds = Dataset(dspath).create()
      repo = ds.repo
      filename = "url_no_size.html"
      # URL-type key without size
      repo.call_annex(
          [
              "addurl",
              "--relaxed",
              "--raw",
              "--file",
              filename,
              httpurl,
          ]
      )
      ds.save()
      # copy target
      ds.create_sibling_ria(
          name="ria",
          url="ria+file://{}".format(storepath),
          storage_sibling="only",
          new_store_ok=True,
      )
      ds.get(filename)
      repo.call_annex(["copy", "--to", "ria", filename])
      ds.drop(filename)
      # in the store and on the web
      assert_equal(len(ds.repo.whereis(filename)), 2)
      # try download, but needs special permissions to even be attempted
      ds.config.set(
          "annex.security.allow-unverified-downloads",
          "ACKTHPPT",
          scope="local",
      )
      repo.call_annex(["copy", "--from", "ria", filename])
      assert_equal(len(ds.repo.whereis(filename)), 3)
      # smoke tests that execute the remaining pieces with the URL key
      repo.call_annex(["fsck", "-f", "ria"])
      assert_equal(len(ds.repo.whereis(filename)), 3)
      # mapped key in whereis output
      assert_in("127.0.0.1", repo.call_annex(["whereis", filename]))
  
      repo.call_annex(["move", "-f", "ria", filename])
      # check that it does not magically reappear, because it actually
      # did not drop the file
      repo.call_annex(["fsck", "-f", "ria"])
      assert_equal(len(ds.repo.whereis(filename)), 2)
  
imports: import logging
  import stat
  from datalad.api import Dataset, clone, create_sibling_ria
  from datalad.cmd import NoCapture
  from datalad.customremotes.ria_utils import create_ds_in_store, create_store, get_layout_locations
  from datalad.distributed.ora_remote import LocalIO, SSHRemoteIO, _sanitize_key
  from datalad.distributed.tests.ria_utils import common_init_opts, get_all_files, populate_dataset
  from datalad.support.exceptions import CommandError, IncompleteResultsError
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_false, assert_in, assert_not_in, assert_raises, assert_repo_status, assert_status, assert_true, has_symlink_capability, known_failure_windows, serve_path_via_http, skip_if_adjusted_branch, skip_if_no_network, skip_if_root, skip_ssh, skip_wo_symlink_capability, slow, swallow_logs, turtle, with_tempfile
  from datalad.utils import Path
label_desc: Use image node_id 22 for calling a global function with example usage: test_url_keys(dspath, storepath, httppath, httpurl) without return types