"""Test the IFC upload endpoint.""" import pytest from httpx import ASGITransport, AsyncClient from app.main import app @pytest.mark.asyncio async def test_upload_rejects_non_ifc(): """Upload endpoint rejects files without .ifc extension.""" transport = ASGITransport(app=app) async with AsyncClient(transport=transport, base_url="http://test") as client: response = await client.post( "/api/upload", files={"file": ("model.obj", b"dummy content", "application/octet-stream")}, ) assert response.status_code == 400 assert "Only .ifc files" in response.json()["detail"] @pytest.mark.asyncio async def test_upload_rejects_empty_filename(): """Upload endpoint rejects files with wrong extension.""" transport = ASGITransport(app=app) async with AsyncClient(transport=transport, base_url="http://test") as client: response = await client.post( "/api/upload", files={"file": ("readme.txt", b"not an ifc file", "text/plain")}, ) assert response.status_code == 400