[Fix] test_databricks: don't assert stream in request body when not passed
Some checks failed
Unit Tests: Proxy DB Operations / proxy-db (auth-checks, tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (remaining, tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py, 30, 8) (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled

The test expected "stream": false in the serialized request body, but
stream is only included in optional_params when explicitly passed by
the caller. litellm.completion() defaults stream=None which is excluded
from non_default_params. Assert individual fields instead of the full
serialized JSON to avoid brittleness around optional field inclusion.
This commit is contained in:
Yuneng Jiang 2026-04-11 13:19:39 -07:00
parent 60d20ace5b
commit 014ec9bf8e
No known key found for this signature in database

View file

@ -688,15 +688,11 @@ def test_completions_uses_databricks_sdk_if_api_key_and_base_not_specified(monke
== f"{base_url}/serving-endpoints/chat/completions"
)
assert mock_post.call_args.kwargs["stream"] == False
assert mock_post.call_args.kwargs["data"] == json.dumps(
{
"model": "dbrx-instruct-071224",
"messages": messages,
"temperature": 0.5,
"extraparam": "testpassingextraparam",
"stream": False,
}
)
sent_data = json.loads(mock_post.call_args.kwargs["data"])
assert sent_data["model"] == "dbrx-instruct-071224"
assert sent_data["messages"] == messages
assert sent_data["temperature"] == 0.5
assert sent_data["extraparam"] == "testpassingextraparam"
def test_embeddings_with_sync_http_handler(monkeypatch):