code: def test_gitcredential(path=None):
      # Note, that credential labels are irrelevant in context of the to be tested
      # Object here.
  
      matching_url = "https://example.datalad.org"
      non_matching_url = "http://some.other.org"
      ds = Dataset(path).create()
      # use git native credential store
      ds.config.add("credential.helper", "store", scope="local")
  
      # store credentials
      cred = GitCredential(
          "cred_label", auth_url=matching_url, dataset=ds
      )
      cred.set(user="dl-user", password="dl-pwd")
  
      # read it again
      cred2 = GitCredential(
          "whatever", auth_url=matching_url, dataset=ds
      )
      assert_equal(cred2.get("user"), "dl-user")
      assert_equal(cred2.get("password"), "dl-pwd")
      # but doesn't deliver w/o matching url
      cred3 = GitCredential(
          "whatever", auth_url=non_matching_url, dataset=ds
      )
      assert_equal(cred3.get("user"), None)
      assert_equal(cred3.get("password"), None)
  
      # delete it
      cred2.delete()
  
      # not there anymore
      cred4 = GitCredential(
          "yet_another", auth_url=matching_url, dataset=ds
      )
      assert_equal(cred4.get("user"), None)
      assert_equal(cred4.get("password"), None)
  
      # delete non-existing
      cred2.delete()
  
file_path: datalad/datalad/downloaders/tests/test_credentials.py
imports: from unittest.mock import patch
  from datalad import cfg
  from datalad.api import Dataset
  from datalad.support.external_versions import external_versions
  from datalad.support.keyring_ import Keyring, MemoryKeyring
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_false, assert_in, assert_raises, assert_true, ok_file_has_content, skip_if, with_tempfile, with_testsui
  from ..credentials import AWS_S3, CompositeCredential, GitCredential, UserPassword
label_desc: Use image node_id 9 for calling a global function with example usage: test_gitcredential(path) without return types