mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
(sap) fix after bot review
This commit is contained in:
parent
033a6ebcd0
commit
9b26087bca
2 changed files with 3 additions and 5 deletions
|
|
@ -167,13 +167,10 @@ def init_conf(profile: Optional[str] = None) -> Dict[str, Any]:
|
|||
def _env_name(name: str) -> str:
|
||||
return f"AICORE_{name.upper()}"
|
||||
|
||||
def extract_credentials(source: Source, exclude: Optional[List[str]] = None) -> Dict[str, str]:
|
||||
def extract_credentials(source: Source) -> Dict[str, str]:
|
||||
"""Extract all credentials from a source."""
|
||||
exclude = exclude or []
|
||||
credentials = {}
|
||||
for cv in CREDENTIAL_VALUES:
|
||||
if cv.name in exclude:
|
||||
continue
|
||||
value = source.get(cv)
|
||||
if value is not None:
|
||||
credentials[cv.name] = cv.transform_fn(value) if cv.transform_fn else value
|
||||
|
|
|
|||
|
|
@ -32,10 +32,11 @@ mock_sap_vcap_service_key_dict = {
|
|||
}]
|
||||
}
|
||||
def _prep_env(monkeypatch):
|
||||
for var in ("AICORE_CLIENT_ID", "AICORE_CLIENT_SECRET", "AICORE_AUTH_URL",
|
||||
for var in ("AICORE_CLIENT_ID", "AICORE_CLIENT_SECRET", "AICORE_AUTH_URL", "AICORE_RESOURCE_GROUP",
|
||||
"AICORE_BASE_URL", "AICORE_CERT_URL", "AICORE_SERVICE_KEY", "VCAP_SERVICES"):
|
||||
monkeypatch.delenv(var, raising=False)
|
||||
monkeypatch.setenv("AICORE_HOME", 'notexist')
|
||||
monkeypatch.setattr('litellm.sap_service_key', None)
|
||||
|
||||
def test_sap_fetch_creds_from_env_service_key(monkeypatch):
|
||||
_prep_env(monkeypatch)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue