- 7 pytest tests covering health, upload validation, API responses, schemas - Updated README with architecture diagram, feature list, design decisions - Live demo link and complete API reference
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
"""Test database models and schema validation."""
|
|
|
|
from app.schemas.element import ProjectOut, ElementOut, PropertyOut
|
|
from uuid import uuid4
|
|
|
|
|
|
def test_project_schema_validates():
|
|
"""ProjectOut schema accepts valid data."""
|
|
data = {
|
|
"id": uuid4(),
|
|
"name": "Test Project",
|
|
"filename": "test.ifc",
|
|
"description": "A test",
|
|
"ifc_schema": "IFC4",
|
|
"element_count": 42,
|
|
}
|
|
project = ProjectOut(**data)
|
|
assert project.name == "Test Project"
|
|
assert project.element_count == 42
|
|
|
|
|
|
def test_element_schema_validates():
|
|
"""ElementOut schema accepts valid data."""
|
|
data = {
|
|
"id": uuid4(),
|
|
"global_id": "2XPyKWY018sA1ygZKgQPtU",
|
|
"ifc_type": "IfcWall",
|
|
"name": "Wall-1",
|
|
"description": "",
|
|
"storey": "Ground Floor",
|
|
}
|
|
element = ElementOut(**data)
|
|
assert element.ifc_type == "IfcWall"
|
|
|
|
|
|
def test_property_schema_validates():
|
|
"""PropertyOut schema accepts valid data."""
|
|
data = {
|
|
"id": uuid4(),
|
|
"pset_name": "Pset_WallCommon",
|
|
"name": "ThermalTransmittance",
|
|
"value": "1.5",
|
|
}
|
|
prop = PropertyOut(**data)
|
|
assert prop.pset_name == "Pset_WallCommon"
|
|
|