mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix test test_is_assemblyai_route
This commit is contained in:
parent
8fd60a420d
commit
915cc064c5
1 changed files with 0 additions and 97 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue