test(oci/embed): expect OCIError from validate_environment when credentials are missing

OCIEmbedConfig.validate_environment now raises eagerly (mirroring OCIChatConfig)
when oci_user/oci_fingerprint/oci_tenancy/oci_compartment_id or oci_key/oci_key_file
is missing. Update the test to match.
This commit is contained in:
mateo-berri 2026-05-21 06:03:19 +00:00
parent 032381a500
commit 1e45b63949
No known key found for this signature in database

View file

@ -123,25 +123,22 @@ class TestOCIEmbeddingConfig:
assert "litellm" in result["user-agent"]
def test_validate_environment_missing_credentials(self):
"""test validate_environment sets headers even with incomplete credentials.
"""test validate_environment raises OCIError when required credentials are missing."""
from litellm.llms.oci.common_utils import OCIError
Credential validation is deferred to signing time — validate_environment only
populates common HTTP headers (content-type, user-agent).
"""
config = OCIEmbeddingConfig()
incomplete_params = {
"oci_user": "ocid1.user.oc1..xxx",
# Missing oci_fingerprint, oci_tenancy, oci_key/oci_key_file, oci_compartment_id
}
result = config.validate_environment(
headers={},
model=TEST_MODEL,
messages=[],
optional_params=incomplete_params,
litellm_params={},
)
assert result["content-type"] == "application/json"
assert "litellm" in result["user-agent"]
with pytest.raises(OCIError, match="Missing required parameters"):
config.validate_environment(
headers={},
model=TEST_MODEL,
messages=[],
optional_params=incomplete_params,
litellm_params={},
)
def test_validate_environment_with_signer(self):
"""test validate_environment passes when oci_signer is provided."""