litellm/tests/test_new_vector_store_endpoints.py
devin-ai-integration[bot] d5173e3d70
test: move 76 live top-level tests to offline unit and integration coverage (#45352)
* test: move 76 live top-level tests to offline unit and integration coverage

* test: keep the mock-param opt-in guard valid once the top-level senders are gone

* test: address review on offline replacements

* docs(test): drop the deleted harness test file from the harness check command

* test: make the key rebind, team member delete and routes integration tests exercise the legacy paths

* test: make fallback, rpm and spend integration contracts deterministic and clean up their rows, assert the rpm limit in usage-based routing

* test: expect the no-deployments error at the rpm limit and cover the strategy check without pre-call checks

* test: hand member cleanups to the scenario instead of growing a budget list, flatten callback kinds

* test: scope the admin health check to the test's own deployment

---------

Co-authored-by: yuneng <yuneng@berri.ai>
2026-10-08 10:33:35 -07:00

77 lines
2.4 KiB
Python

"""
Comprehensive test for new vector store endpoints: retrieve, list, update, delete
Tests both basic functionality and complex scenarios including target_model_names
"""
import asyncio
from unittest.mock import AsyncMock, patch
import pytest
import litellm
@pytest.mark.asyncio
async def test_async_vector_store_update():
"""Test async vector store update."""
mock_response = {
"id": "vs_async123",
"name": "Updated Async Name",
}
with patch(
"litellm.vector_stores.main.aupdate",
new=AsyncMock(return_value=mock_response),
) as mock_aupdate:
router = litellm.Router(model_list=[])
result = await router.avector_store_update(
vector_store_id="vs_async123",
name="Updated Async Name",
custom_llm_provider="openai",
)
assert result["name"] == "Updated Async Name"
mock_aupdate.assert_called_once()
def test_router_initializes_new_endpoints():
"""Test that router properly initializes the new vector store endpoints."""
router = litellm.Router(model_list=[])
# Verify all new endpoints are initialized
assert hasattr(router, "vector_store_retrieve")
assert hasattr(router, "avector_store_retrieve")
assert hasattr(router, "vector_store_list")
assert hasattr(router, "avector_store_list")
assert hasattr(router, "vector_store_update")
assert hasattr(router, "avector_store_update")
assert hasattr(router, "vector_store_delete")
assert hasattr(router, "avector_store_delete")
# Verify they are callable
assert callable(router.vector_store_retrieve)
assert callable(router.avector_store_retrieve)
assert callable(router.vector_store_list)
assert callable(router.avector_store_list)
assert callable(router.vector_store_update)
assert callable(router.avector_store_update)
assert callable(router.vector_store_delete)
assert callable(router.avector_store_delete)
if __name__ == "__main__":
# Run basic smoke tests
print("Running smoke tests for new vector store endpoints...")
# Test router initialization
print("✓ Testing router initialization...")
test_router_initializes_new_endpoints()
print("✓ Router initialization successful")
# Test async operations
print("✓ Testing async operations...")
asyncio.run(test_async_vector_store_update())
print("✓ Async operations successful")
print("\n✅ All smoke tests passed!")