code: def test_create_push_url(
      detection_path=None, ds_path=None, store_path=None
  ):
      store_path = Path(store_path)
      ds_path = Path(ds_path)
      detection_path = Path(detection_path)
  
      ds = Dataset(ds_path).create(force=True)
      ds.save()
  
      # patch SSHConnection to signal it was used:
      from datalad.support.sshconnector import SSHManager
  
      def detector(f, d):
          @wraps(f)
          def _wrapper(*args, **kwargs):
              d.touch()
              return f(*args, **kwargs)
  
          return _wrapper
  
      url = "ria+{}".format(store_path.as_uri())
      push_url = "ria+ssh://datalad-test{}".format(
          store_path.as_posix()
      )
      assert not detection_path.exists()
  
      with patch(
          "datalad.support.sshconnector.SSHManager.get_connection",
          new=detector(SSHManager.get_connection, detection_path),
      ):
          ds.create_sibling_ria(
              url, "datastore", push_url=push_url, new_store_ok=True
          )
          # used ssh_manager despite file-url hence used push-url (ria+ssh):
          assert detection_path.exists()
  
          # correct config in special remote:
          sr_cfg = ds.repo.get_special_remotes()[
              ds.siblings(name="datastore-storage")[0]["annex-uuid"]
          ]
          eq_(sr_cfg["url"], url)
          eq_(sr_cfg["push-url"], push_url)
  
          # git remote based on url (local path):
          eq_(
              ds.config.get("remote.datastore.url"),
              (store_path / ds.id[:3] / ds.id[3:]).as_posix(),
          )
          eq_(
              ds.config.get("remote.datastore.pushurl"),
              "ssh://datalad-test{}".format(
                  (store_path / ds.id[:3] / ds.id[3:]).as_posix()
              ),
          )
  
          # git-push uses SSH:
          detection_path.unlink()
          ds.push(".", to="datastore", data="nothing")
          assert detection_path.exists()
  
          # data push
          # Note, that here the patching has no effect, since the special remote
          # is running in a subprocess of git-annex. Hence we can't detect SSH
          # usage really. However, ORA remote is tested elsewhere - if it succeeds
          # all should be good wrt `create-sibling-ria`.
          ds.repo.call_annex(["copy", ".", "--to", "datastore-storage"])
  
file_path: datalad/datalad/distributed/tests/test_create_sibling_ria.py
imports: import logging
  import os.path
  from functools import wraps
  from unittest.mock import patch
  from datalad import cfg
  from datalad.api import Dataset, clone
  from datalad.support.network import get_local_file_url
  from datalad.tests.utils_pytest import assert_false, assert_in, assert_raises, assert_repo_status, assert_result_count, assert_status, attr, chpwd, eq_, known_failure_githubci_win, ok_exists, skip_if_on_windows, skip_ssh, skip_wo_symlink_capability, slow, swallow_logs, with_tempfile, with_tree
  from datalad.utils import Path
label_desc: Use image node_id 5 for calling a global function with example usage: test_create_push_url(detection_path, ds_path, store_path) and returns: _wrapper, f