Spaces:
Runtime error
Runtime error
Download src/tests/integration/test_ingestion_route.py from VashuTheGreat2/Multi-Rag: direct link, hf CLI and curl.
- Browser
- Download file 897 Bytes
-
https://huggingface.co/spaces/VashuTheGreat2/Multi-Rag/resolve/main/src/tests/integration/test_ingestion_route.py
- Command line
-
hf download hf://spaces/VashuTheGreat2/Multi-Rag/src/tests/integration/test_ingestion_route.py
-
curl -L -o test_ingestion_route.py https://huggingface.co/spaces/VashuTheGreat2/Multi-Rag/resolve/main/src/tests/integration/test_ingestion_route.py
897 Bytes
| from unittest.mock import AsyncMock, patch | |
| import io | |
| def test_pass_ingest(mock_process_file, client): | |
| mock_process_file.return_value = True | |
| response = client.post( | |
| "/api/v1/ingest", | |
| headers={"x-ingestion-password": "aloo"}, | |
| files={"file": ("sample.txt", io.BytesIO(b"dummy file content"), "text/plain")}, | |
| ) | |
| assert response.status_code == 200 | |
| def test_failed_ingest_no_password(client): | |
| response = client.post( | |
| "/api/v1/ingest", | |
| files={"file": ("sample.txt", io.BytesIO(b"dummy file content"), "text/plain")}, | |
| ) | |
| assert response.status_code == 401 | |
| def test_failed_ingest(client): | |
| response = client.post( | |
| "/api/v1/ingest", | |
| headers={"x-ingestion-password": "aloo"}, | |
| files=None, | |
| ) | |
| assert response.status_code == 400 | |