Spaces:
Runtime error
Runtime error
Download tests/api/test_query.py from zinoubm/openpdf-backend: direct link, hf CLI and curl.
- Browser
- Download file 639 Bytes
-
https://huggingface.co/spaces/zinoubm/openpdf-backend/resolve/main/tests/api/test_query.py
- Command line
-
hf download hf://spaces/zinoubm/openpdf-backend/tests/api/test_query.py
-
curl -L -o test_query.py https://huggingface.co/spaces/zinoubm/openpdf-backend/resolve/main/tests/api/test_query.py
639 Bytes
| from httpx import AsyncClient | |
| from app.core.config import settings | |
| from app.models.user import User | |
| from tests.utils import get_jwt_header | |
| class TestQuery: | |
| async def test_query( | |
| self, | |
| client: AsyncClient, | |
| create_user, | |
| ): | |
| user: User = await create_user() | |
| jwt_header = get_jwt_header(user) | |
| payload = { | |
| "query": "What is the meaning of life?", | |
| "document_id": 11, | |
| } | |
| resp = await client.post( | |
| settings.API_PATH + "/queries/", | |
| json=payload, | |
| headers=jwt_header, | |
| ) | |
| assert resp.status_code == 200 | |