mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 17:05:41 +01:00
Some checks failed
release-please / release-please (push) Has been cancelled
tests / setup (push) Has been cancelled
tests / ${{ matrix.quality-command }} (black) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (mypy) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (ruff) (push) Has been cancelled
tests / test (push) Has been cancelled
tests / all_checks_passed (push) Has been cancelled
* chore: update libraries * fix: mypy * chore: more updates * fix: mypy/black * chore: fix docker warnings * fix: mypy * fix: black
24 lines
705 B
Python
24 lines
705 B
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from private_gpt.server.ingest.ingest_router import IngestResponse
|
|
|
|
|
|
class IngestHelper:
|
|
def __init__(self, test_client: TestClient):
|
|
self.test_client = test_client
|
|
|
|
def ingest_file(self, path: Path) -> IngestResponse:
|
|
files = {"file": (path.name, path.open("rb"))}
|
|
|
|
response = self.test_client.post("/v1/ingest/file", files=files)
|
|
assert response.status_code == 200
|
|
ingest_result = IngestResponse.model_validate(response.json())
|
|
return ingest_result
|
|
|
|
|
|
@pytest.fixture
|
|
def ingest_helper(test_client: TestClient) -> IngestHelper:
|
|
return IngestHelper(test_client)
|