code: def test_composite_credential1():
      # basic test of composite credential
      keyring = MemoryKeyring()
      cred = _CCred1("name", keyring=keyring)
      # When queried, does the chain
      assert_equal(
          cred(), {"user": "user1_1", "password": "password1_2"}
      )
      # But the "Front" credential is exposed to the user
      assert_equal(cred.get("user"), "user1")
      assert_equal(keyring.get("name", "user"), "user1")
      assert_raises(ValueError, cred.get, "unknown_field")
      assert_equal(cred.get("password"), "password1")
      assert_equal(keyring.get("name", "password"), "password1")
      # ATM composite credential stores "derived" ones unconditionally in the
      # keyring as well
      assert_equal(keyring.get("name:1", "user"), "user1_1")
      assert_equal(keyring.get("name:1", "password"), "password1_2")
  
      # and now enter new should remove "derived" entries
      cred.enter_new()
      assert_equal(keyring.get("name", "user"), "user2")
      assert_equal(keyring.get("name", "password"), "password2")
      # we immediately refresh all credentials in the chain
      assert_equal(keyring.get("name:1", "user"), "user2_1")
      assert_equal(keyring.get("name:1", "password"), "password2_2")
      assert_equal(
          cred(), {"user": "user2_1", "password": "password2_2"}
      )
  
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 5 for calling a global function with example usage: test_composite_credential1() without return types