-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_server.py
More file actions
33 lines (27 loc) · 907 Bytes
/
test_server.py
File metadata and controls
33 lines (27 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from fastapi import status
from fastapi.testclient import TestClient
from lecsum import DEFAULT_CONFIG
from server import app
client = TestClient(app)
def test_summary_file_not_found():
response = client.post(
"/summarize",
json={
"whisper_model": DEFAULT_CONFIG["whisper_model"],
"ollama_model": DEFAULT_CONFIG["ollama_model"],
"prompt": DEFAULT_CONFIG["prompt"],
"file": "not_a_file.mp3",
},
)
assert response.status_code == status.HTTP_404_NOT_FOUND
def test_summary():
response = client.post(
"/summarize",
json={
"whisper_model": DEFAULT_CONFIG["whisper_model"],
"ollama_model": DEFAULT_CONFIG["ollama_model"],
"prompt": DEFAULT_CONFIG["prompt"],
"file": "test/audio.mp3",
},
)
assert response.status_code == status.HTTP_200_OK