code: def test_as_common_datasource(
      testbed=None,
      viapath=None,
      viaurl=None,
      remotepath=None,
      url=None,
      remotepath2=None,
      url2=None,
  ):
      ds = Dataset(remotepath).create()
      (ds.pathobj / "testfile").write_text("likemagic")
      (ds.pathobj / "testfile2").write_text("likemagic2")
      ds.save()
  
      # make clonable via HTTP
      ds.repo.call_git(["update-server-info"])
  
      # populate location of the 2nd url, so we have two remotes with different UUIDs
      ds2 = clone(source=remotepath, path=remotepath2)
      ds2.get("testfile")
      ds2.repo.call_git(["update-server-info"])
  
      # this does not work for remotes that have path URLs
      ds_frompath = clone(source=remotepath, path=viapath)
      res = ds_frompath.siblings(
          "configure",
          name=DEFAULT_REMOTE,
          as_common_datasrc="mike",
          on_failure="ignore",
          result_renderer="disabled",
      )
      assert_in_results(
          res,
          status="impossible",
          message="cannot configure as a common data source, URL protocol "
          "is not http or https",
      )
  
      # but it works for HTTP
      ds_fromurl = clone(source=url, path=viaurl)
      res = ds_fromurl.siblings(
          "configure",
          name=DEFAULT_REMOTE,
          as_common_datasrc="mike2",
          result_renderer="disabled",
      )
      assert_status("ok", res)
  
      # same thing should be possible by adding a fresh remote
      # We need to do it on a different URL since some versions of git-annex
      # such as 10.20220322-1~ndall+1 might refuse operate with multiple remotes
      # with identical URLs, and otherwise just reuse the same UUID/remote
      res = ds_fromurl.siblings(
          "add",
          name="fresh",
          # we must amend the URL given by serve_path_via_http, because
          # we are serving the root of a non-bare repository, but git-annex
          # needs to talk to its .git (git-clone would also not eat
          # `url` unmodified).
          url=url2 + ".git",
          as_common_datasrc="fresh-sr",
          result_renderer="disabled",
      )
      assert_status("ok", res)
  
      # now try if it works. we will clone the clone, and get a repo that does
      # not know its ultimate origin. still, we should be able to pull data
      # from it via the special remote
      testbed = clone(source=ds_fromurl, path=testbed)
      assert_status("ok", testbed.get("testfile"))
      eq_("likemagic", (testbed.pathobj / "testfile").read_text())
      # and the other one
      assert_status("ok", testbed.get("testfile2"))
  
      # Let's get explicitly from both remotes which would not work if URL
      # above is wrong or one of the remotes not autoenabled
      for remote in "mike2", "fresh-sr":
          assert_status("ok", testbed.drop("testfile"))
          assert_status("ok", testbed.get("testfile", source=remote))
  
file_path: datalad/datalad/distribution/tests/test_siblings.py
imports: from datalad.api import Dataset, clone, create, install, siblings
  from datalad.support.exceptions import InsufficientArgumentsError
  from datalad.support.gitrepo import GitRepo
  from datalad.support.path import basename
  from datalad.support.path import join
  from datalad.support.path import normpath, relpath
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, assert_false, assert_in, assert_in_results, assert_not_in, assert_raises, assert_result_count, assert_status, chpwd, create_tree, eq_, ok_, on_appveyor, serve_path_via_http, with_sameas_remote, with_tempfile
  from datalad.utils import Path, on_windows
  import pytest
label_desc: Use image node_id 10 for calling a global function with example usage: test_as_common_datasource(testbed, viapath, viaurl, remotepath, url, remotepath2, url2) without return types