Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths = tests
python_files = test_*.py
19 changes: 19 additions & 0 deletions src/tests/tests_factcheck_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# tests/test_factcheck_endpoint.py

import pytest
from httpx import AsyncClient
from app import app # Adjust the import based on your project structure

@pytest.mark.asyncio
async def test_factcheck_endpoint():
async with AsyncClient(app=app, base_url="http://test") as ac:
payload = {
"claim": "The Eiffel Tower is located in Berlin."
}
response = await ac.post("/factcheck", json=payload)
assert response.status_code == 200
data = response.json()
assert "verdict" in data
assert "evidence" in data
assert data["verdict"] in ["true", "false", "uncertain"]

12 changes: 12 additions & 0 deletions src/tests/tests_health_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# tests/test_health_endpoint.py

import pytest
from httpx import AsyncClient
from app import app

@pytest.mark.asyncio
async def test_health_endpoint():
async with AsyncClient(app=app, base_url="http://test") as ac:
response = await ac.get("/health")
assert response.status_code == 200
assert response.json() == {"status": "ok"}