test(rag): remove internal patching from validation tests

This commit is contained in:
Yujong Lee 2026-08-30 19:21:57 -07:00
parent aef7a7d3da
commit e4fe911273

View file

@ -47,24 +47,16 @@ def client_internal_user():
app.dependency_overrides = original_overrides
def test_rag_ingest_rejects_unsupported_provider_before_execution(
def test_rag_ingest_rejects_unsupported_provider(
client_internal_user: TestClient,
) -> None:
with (
patch(
"litellm.proxy.rag_endpoints.endpoints.litellm.aingest",
new_callable=AsyncMock,
return_value={"status": "completed", "vector_store_id": "vs_unexpected"},
) as mock_aingest,
patch("litellm.proxy.proxy_server.prisma_client", None),
):
response: Final = client_internal_user.post(
"/v1/rag/ingest",
json={
"file_id": "file-test",
"ingest_options": {"vector_store": {"custom_llm_provider": "milvus"}},
},
)
response: Final = client_internal_user.post(
"/v1/rag/ingest",
json={
"file_id": "file-test",
"ingest_options": {"vector_store": {"custom_llm_provider": "milvus"}},
},
)
assert response.status_code == 400
assert response.json() == {
@ -73,34 +65,25 @@ def test_rag_ingest_rejects_unsupported_provider_before_execution(
"Supported providers: openai, bedrock, gemini, s3_vectors, vertex_ai"
}
}
mock_aingest.assert_not_awaited()
def test_rag_ingest_rejects_non_string_provider_before_execution(
def test_rag_ingest_rejects_non_string_provider(
client_internal_user: TestClient,
) -> None:
with (
patch(
"litellm.proxy.rag_endpoints.endpoints.litellm.aingest",
new_callable=AsyncMock,
) as mock_aingest,
patch("litellm.proxy.proxy_server.prisma_client", None),
):
response: Final = client_internal_user.post(
"/v1/rag/ingest",
json={
"file_id": "file-test",
"ingest_options": {
"vector_store": {"custom_llm_provider": {"provider": "milvus"}}
},
response: Final = client_internal_user.post(
"/v1/rag/ingest",
json={
"file_id": "file-test",
"ingest_options": {
"vector_store": {"custom_llm_provider": {"provider": "milvus"}}
},
)
},
)
assert response.status_code == 400
assert response.json() == {
"detail": {"error": "custom_llm_provider must be a string"}
}
mock_aingest.assert_not_awaited()
def test_internal_user_viewer_rag_ingest_without_vector_store_id_rejected(