mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
(sap) fix after bot review
This commit is contained in:
parent
0fde223673
commit
1f0bdb10c1
2 changed files with 5 additions and 3 deletions
|
|
@ -249,17 +249,17 @@ def fetch_credentials(service_key: Optional[Union[str, dict]] = None, profile: O
|
|||
if config.get(f'AICORE_{cv.name.upper()}') is not None
|
||||
else config.get(cv.name))),
|
||||
Source("VCAP service",
|
||||
lambda cv: _str_or_none(
|
||||
lambda cv: (_str_or_none(
|
||||
_get_nested(vcap_service, (("credentials",) + cv.vcap_key) if cv.vcap_key else (cv.name,))
|
||||
)
|
||||
if vcap_service else None), # type: ignore[arg-type]
|
||||
if vcap_service else None)), # type: ignore[arg-type]
|
||||
]
|
||||
|
||||
credentials = resolve_credentials(sources)
|
||||
|
||||
resource_group = resolve_resource_group(sources)
|
||||
|
||||
if resource_group:
|
||||
if resource_group is not None:
|
||||
credentials['resource_group'] = resource_group
|
||||
|
||||
if 'cert_url' in credentials:
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ def test_sap_fetch_creds_from_arg_service_key(monkeypatch):
|
|||
|
||||
def test_fetch_creds_from_env_vcap_service(monkeypatch):
|
||||
_prep_env(monkeypatch)
|
||||
for var in ("AICORE_CLIENT_ID", "AICORE_CLIENT_SECRET", "AICORE_AUTH_URL", "AICORE_BASE_URL", "AICORE_CERT_URL"):
|
||||
monkeypatch.delenv(var, raising=False)
|
||||
monkeypatch.setenv("VCAP_SERVICES", json.dumps(mock_sap_vcap_service_key_dict))
|
||||
creds = sap_credentials.fetch_credentials()
|
||||
assert creds['client_id'] == "vcap-clientid"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue