from starlette.testclient import TestClient
from fmatch.saas.main import create_app


def test_presign():
    client = TestClient(create_app())
    r = client.post("/api/v2/uploads/presign", json={"content_type": "text/csv"})
    assert r.status_code == 200, r.text
    data = r.json()
    assert "object_id" in data and data["object_id"].startswith("uploads/")
    assert "put_url" in data and isinstance(data["put_url"], str)
    assert "get_url" in data and isinstance(data["get_url"], str)

