From 915cc064c53552f85a955ef5cf0bcce081ec84d9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 3 Feb 2025 21:58:32 -0800 Subject: [PATCH] fix test test_is_assemblyai_route --- .../test_assemblyai_unit_tests_passthrough.py | 97 ------------------- 1 file changed, 97 deletions(-) diff --git a/tests/pass_through_unit_tests/test_assemblyai_unit_tests_passthrough.py b/tests/pass_through_unit_tests/test_assemblyai_unit_tests_passthrough.py index 71bae496714..8279d4c9884 100644 --- a/tests/pass_through_unit_tests/test_assemblyai_unit_tests_passthrough.py +++ b/tests/pass_through_unit_tests/test_assemblyai_unit_tests_passthrough.py @@ -103,103 +103,6 @@ def test_poll_assembly_for_transcript_response( assert transcript == AssemblyAITranscriptResponse(**mock_transcript_response) -@pytest.fixture -def mock_request(): - request = Mock() - request.method = "POST" - request.headers = {} - request.url = httpx.URL("http://test.com/test") - return request - - -@pytest.fixture -def mock_response(): - return Mock() - - -@pytest.fixture -def mock_user_api_key_dict(): - return {"api_key": "test-key"} - - -@patch("litellm.utils.get_secret") -@patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.create_pass_through_route" -) -@pytest.mark.asyncio() -async def test_assemblyai_proxy_route_basic_post( - mock_create_route, - mock_get_secret, - mock_request, - mock_response, - mock_user_api_key_dict, -): - """Test basic POST request handling for AssemblyAI proxy route""" - from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import ( - assemblyai_proxy_route, - ) - - # Setup mocks - mock_get_secret.return_value = "test-assemblyai-key" - mock_request.json = AsyncMock(return_value={"text": "test"}) - mock_endpoint_func = AsyncMock(return_value={"result": "success"}) - mock_create_route.return_value = mock_endpoint_func - - result = await assemblyai_proxy_route( - endpoint="v2/transcript", - request=mock_request, - fastapi_response=mock_response, - user_api_key_dict=mock_user_api_key_dict, - ) - - assert result == {"result": "success"} - mock_create_route.assert_called_once_with( - endpoint="v2/transcript", - target="https://api.assemblyai.com/v2/transcript", - custom_headers={"Authorization": "test-assemblyai-key"}, - ) - - -@patch("litellm.utils.get_secret") -@patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.create_pass_through_route" -) -@pytest.mark.asyncio() -async def test_assemblyai_proxy_route_get_transcript( - mock_create_route, - mock_get_secret, - mock_request, - mock_response, - mock_user_api_key_dict, -): - """Test GET request handling for retrieving a specific transcript from AssemblyAI""" - from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import ( - assemblyai_proxy_route, - ) - - # Setup mocks - mock_get_secret.return_value = "test-assemblyai-key" - mock_request.method = "GET" - mock_endpoint_func = AsyncMock( - return_value={"id": "test-transcript-id", "status": "completed"} - ) - mock_create_route.return_value = mock_endpoint_func - - result = await assemblyai_proxy_route( - endpoint="v2/transcript/test-transcript-id", - request=mock_request, - fastapi_response=mock_response, - user_api_key_dict=mock_user_api_key_dict, - ) - - assert result == {"id": "test-transcript-id", "status": "completed"} - mock_create_route.assert_called_once_with( - endpoint="v2/transcript/test-transcript-id", - target="https://api.assemblyai.com/v2/transcript/test-transcript-id", - custom_headers={"Authorization": "test-assemblyai-key"}, - ) - - def test_is_assemblyai_route(): """ Test that the is_assemblyai_route method correctly identifies AssemblyAI routes