Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSamhuns committed Sep 12, 2024
1 parent 8435a25 commit f18effd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tests/routes/test_sql_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ async def test_sql_question_answer(test_app_asyncio: httpx.AsyncClient, test_mys
# Test for a specific log file type and a sample question
params = {
'log_type': 'anomaly_detection_log',
'question': 'Give me the latest logs',
'model': 'llamafile',
}
response = await test_app_asyncio.post("sql/qa/{LogFileType}", params=params)
request_data = {
'query': 'Give me the latest 15 logs'
}
response = await test_app_asyncio.post("sql/qa?log_type=anomaly_detection_log", params=params, json=request_data)
data = response.json()
assert response.status_code == 200
assert data["status"] == "success"
Expand Down
4 changes: 2 additions & 2 deletions tests/routes/test_summarize_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async def test_summarize_single_file(
"""Test the individual file summarize mode"""
upload_file = gen_mock_upload_file()
response = await test_app_asyncio.post(
"summarize/files/{SummarizerMode}?summarizer_mode=" + summarizer_mode,
f"summarize/files?summarizer_mode={summarizer_mode}",
files={"files": (upload_file.filename,
upload_file.file.read(), "text/plain")},
)
Expand All @@ -39,7 +39,7 @@ async def test_summarize_multiple_files(
upload_file1 = gen_mock_upload_file("sample1.log")
upload_file2 = gen_mock_upload_file("sample2.log")
response = await test_app_asyncio.post(
"summarize/files/{SummarizerMode}?summarizer_mode=" + summarizer_mode,
f"summarize/files?summarizer_mode={summarizer_mode}",
files=[
('files', (upload_file1.filename, upload_file1.file.read(), "text/plain")),
('files', (upload_file2.filename, upload_file2.file.read(), "text/plain")),],
Expand Down
2 changes: 1 addition & 1 deletion tests/routes/test_upsert_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def test_log_upsert(
files = [("files", (fpath, fcontent, "text/plain"))]

response = await test_app_asyncio.post(
"/upsert/logs/{LogFileType}?log_type=anomaly_detection_log",
"/upsert/logs?log_type=anomaly_detection_log",
files=files)

data = response.json()
Expand Down

0 comments on commit f18effd

Please sign in to comment.