From 1e45b639492188c399d3cc120335c07da831239b Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 21 May 2026 06:03:19 +0000 Subject: [PATCH] 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. --- .../llms/oci/embed/test_oci_embedding.py | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/test_litellm/llms/oci/embed/test_oci_embedding.py b/tests/test_litellm/llms/oci/embed/test_oci_embedding.py index 4f4c1937fcd..61c13ad62a1 100644 --- a/tests/test_litellm/llms/oci/embed/test_oci_embedding.py +++ b/tests/test_litellm/llms/oci/embed/test_oci_embedding.py @@ -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."""