CoolFace
Apppublic

imran-decoder/filecrackhead1

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
conftest.py71 linesDownload Raw Back to tests
1"""2pytest configuration and shared fixtures.3"""4 5import io6import pytest7from fastapi.testclient import TestClient8 9from app.main import app10 11 12@pytest.fixture(scope="module")13def client():14    with TestClient(app) as c:15        yield c16 17 18# ---------------------------------------------------------------------------19# Sample file factories20# ---------------------------------------------------------------------------21 22def make_tiny_pdf() -> bytes:23    """Minimal valid PDF (single page, no content)."""24    return b"""%PDF-1.4251 0 obj<</Type/Catalog/Pages 2 0 R>>endobj262 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj273 0 obj<</Type/Page/MediaBox[0 0 612 792]/Parent 2 0 R>>endobj28xref290 4300000000000 65535 f 310000000009 00000 n 320000000058 00000 n 330000000115 00000 n 34trailer<</Size 4/Root 1 0 R>>35startxref3619037%%EOF"""38 39 40def make_tiny_txt() -> bytes:41    return b"Hello, World! This is a test document."42 43 44def make_tiny_html() -> bytes:45    return b"<html><body><h1>Hello</h1><p>Test document.</p></body></html>"46 47 48def make_oversized_content(mb: int = 30) -> bytes:49    """Generate content exceeding the 50MB default limit."""50    return b"A" * (mb * 1024 * 1024)51 52 53@pytest.fixture54def tiny_pdf():55    return make_tiny_pdf()56 57 58@pytest.fixture59def tiny_txt():60    return make_tiny_txt()61 62 63@pytest.fixture64def tiny_html():65    return make_tiny_html()66 67 68@pytest.fixture69def oversized_content():70    return make_oversized_content(26)71