feat: scaffold agentic interior design workflow
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from app.main import app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def transport() -> httpx.ASGITransport:
|
||||
return httpx.ASGITransport(app=app)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_health(transport: httpx.ASGITransport) -> None:
|
||||
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
response = await client.get("/v1/health")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "ok"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_demo_project_contract(transport: httpx.ASGITransport) -> None:
|
||||
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
response = await client.get("/v1/projects/demo-apartment")
|
||||
assert response.status_code == 200
|
||||
body = response.json()
|
||||
assert body["stage"] == "plan_review"
|
||||
assert body["plan"]["cad_layer_count"] == 43
|
||||
@@ -0,0 +1,45 @@
|
||||
import pytest
|
||||
|
||||
from app.domain.models import CommandRequest, WorkflowCommand, WorkflowStage
|
||||
from app.domain.workflow import InvalidTransitionError, WorkflowConflictError, apply_command
|
||||
from app.repositories.memory import create_demo_project
|
||||
|
||||
|
||||
def test_confirm_plan_advances_revision_and_stage() -> None:
|
||||
project = create_demo_project()
|
||||
updated = apply_command(
|
||||
project,
|
||||
CommandRequest(
|
||||
command=WorkflowCommand.CONFIRM_PLAN,
|
||||
expected_revision=project.revision,
|
||||
payload={"ceiling_height_mm": 2900},
|
||||
),
|
||||
)
|
||||
|
||||
assert updated.stage == WorkflowStage.BLOCKOUT
|
||||
assert updated.revision == project.revision + 1
|
||||
assert updated.plan.ceiling_height_mm == 2900
|
||||
|
||||
|
||||
def test_stale_revision_is_rejected() -> None:
|
||||
project = create_demo_project()
|
||||
with pytest.raises(WorkflowConflictError):
|
||||
apply_command(
|
||||
project,
|
||||
CommandRequest(
|
||||
command=WorkflowCommand.CONFIRM_PLAN,
|
||||
expected_revision=project.revision - 1,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def test_invalid_command_is_rejected() -> None:
|
||||
project = create_demo_project()
|
||||
with pytest.raises(InvalidTransitionError):
|
||||
apply_command(
|
||||
project,
|
||||
CommandRequest(
|
||||
command=WorkflowCommand.REQUEST_RENDER,
|
||||
expected_revision=project.revision,
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user