From 858a8b5fcecbb4248664103fea9aa10edc663459 Mon Sep 17 00:00:00 2001 From: Mubashir Osmani Date: Fri, 10 Jul 2026 20:27:06 +0000 Subject: [PATCH] test(proxy): run secure_share tests in CI shard and cover all branches Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .github/workflows/test-unit-proxy-endpoints.yml | 1 + .../secure_share/test_secure_share_endpoints.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/test-unit-proxy-endpoints.yml b/.github/workflows/test-unit-proxy-endpoints.yml index cbb36eebdb9..90de95e17a7 100644 --- a/.github/workflows/test-unit-proxy-endpoints.yml +++ b/.github/workflows/test-unit-proxy-endpoints.yml @@ -46,6 +46,7 @@ jobs: tests/test_litellm/proxy/rag_endpoints tests/test_litellm/proxy/realtime_endpoints tests/test_litellm/proxy/ui_crud_endpoints + tests/test_litellm/proxy/secure_share tests/test_litellm/proxy/utils workers: 2 reruns: 2 diff --git a/tests/test_litellm/proxy/secure_share/test_secure_share_endpoints.py b/tests/test_litellm/proxy/secure_share/test_secure_share_endpoints.py index 62ccfc4fb4f..d01d5c24700 100644 --- a/tests/test_litellm/proxy/secure_share/test_secure_share_endpoints.py +++ b/tests/test_litellm/proxy/secure_share/test_secure_share_endpoints.py @@ -93,6 +93,20 @@ def test_create_request_rejects_unknown_expiry(): SecureShareCreateRequest(ciphertext=_b64(b"c"), salt=_b64(b"s"), iv=_b64(b"i"), expiry="30d") +def test_create_request_rejects_empty_ciphertext(): + with pytest.raises(ValidationError): + SecureShareCreateRequest(ciphertext="", salt=_b64(b"s"), iv=_b64(b"i"), expiry="1h") + + +@pytest.mark.asyncio +async def test_create_returns_500_when_db_not_connected(): + with patch.multiple("litellm.proxy.proxy_server", prisma_client=None, litellm_proxy_admin_name="default_admin"): + with pytest.raises(HTTPException) as exc: + await create_secure_share(request=_valid_request(), user_api_key_dict=_admin()) + + assert exc.value.status_code == 500 + + @pytest.mark.asyncio async def test_create_stores_ciphertext_and_computes_expiry(): request = _valid_request(SecureShareExpiry.ONE_DAY)