130 lines
3.2 KiB
Python
130 lines
3.2 KiB
Python
from app.modules.design.domain.value_objects import (
|
|
ArchitectureLayer,
|
|
FileStatus,
|
|
ModuleLayer,
|
|
)
|
|
|
|
|
|
def test_file_status_values():
|
|
assert FileStatus.OK == "ok"
|
|
assert FileStatus.SPARSE == "sparse"
|
|
assert FileStatus.MISSING == "missing"
|
|
assert FileStatus.TEMPLATE_RESIDUE == "template-residue"
|
|
assert FileStatus.PLACEHOLDER_HEAVY == "placeholder-heavy"
|
|
|
|
|
|
def test_architecture_layer_values():
|
|
assert ArchitectureLayer.BUSINESS == "business"
|
|
assert ArchitectureLayer.APPLICATION == "application"
|
|
assert ArchitectureLayer.DATA == "data"
|
|
assert ArchitectureLayer.TECHNOLOGY == "technology"
|
|
|
|
|
|
def test_module_layer_values():
|
|
assert ModuleLayer.DOMAIN == "domain"
|
|
assert ModuleLayer.APPLICATION == "application"
|
|
assert ModuleLayer.INFRASTRUCTURE == "infrastructure"
|
|
assert ModuleLayer.INTERFACES == "interfaces"
|
|
|
|
|
|
from app.modules.design.domain.entities import (
|
|
ADR,
|
|
ApiContract,
|
|
Capability,
|
|
ChangeLogEntry,
|
|
CodebaseAlignment,
|
|
DataFlow,
|
|
DataSecurity,
|
|
DesignDocument,
|
|
Domain,
|
|
DomainEntity,
|
|
DomainModule,
|
|
Entity,
|
|
Environment,
|
|
ExternalSystem,
|
|
Integration,
|
|
Module,
|
|
ModuleBoundaryRule,
|
|
OperationalBaseline,
|
|
ReleasePlan,
|
|
RuntimeComponent,
|
|
RuntimeTopology,
|
|
Scenario,
|
|
ScopeAndGoals,
|
|
SharedTerm,
|
|
SolutionLayer,
|
|
SystemContext,
|
|
TechSelection,
|
|
TraceabilityLink,
|
|
UbiquitousTerm,
|
|
UserJourney,
|
|
ValueFlow,
|
|
)
|
|
|
|
|
|
def test_capability_creation():
|
|
cap = Capability(
|
|
capability_id="CAP-01",
|
|
name="test",
|
|
description="desc",
|
|
priority="must",
|
|
phase="MVP",
|
|
related_value_flows=["VF-01"],
|
|
)
|
|
assert cap.capability_id == "CAP-01"
|
|
assert cap.related_value_flows == ["VF-01"]
|
|
|
|
|
|
def test_module_creation():
|
|
mod = Module(
|
|
module_id="MOD-01",
|
|
name="test",
|
|
layer="backend",
|
|
description="desc",
|
|
phase="MVP",
|
|
depends_on=["MOD-02"],
|
|
capabilities=["CAP-01"],
|
|
)
|
|
assert mod.depends_on == ["MOD-02"]
|
|
|
|
|
|
def test_traceability_link_list_fields():
|
|
tl = TraceabilityLink(
|
|
trace_id="TR-01",
|
|
capability_id="CAP-01",
|
|
module_id="MOD-01",
|
|
entity_ids=["ENT-01", "ENT-02"],
|
|
value_flow_ids=["VF-01"],
|
|
notes="test",
|
|
)
|
|
assert len(tl.entity_ids) == 2
|
|
|
|
|
|
def test_design_document_list_fields():
|
|
dd = DesignDocument(
|
|
doc_id="DOC-01",
|
|
title="test",
|
|
version="0.1",
|
|
status="draft",
|
|
owners=["owner1"],
|
|
upstream=["a.md"],
|
|
downstream=["b.md"],
|
|
file_path="test.md",
|
|
)
|
|
assert dd.owners == ["owner1"]
|
|
|
|
|
|
def test_all_31_entities_importable():
|
|
"""Verify all 31 entity classes can be imported."""
|
|
entities = [
|
|
Capability, ValueFlow, UserJourney, ScopeAndGoals,
|
|
Module, Integration, ExternalSystem, ApiContract,
|
|
CodebaseAlignment, ModuleBoundaryRule, SystemContext, SolutionLayer,
|
|
Entity, DataFlow, DataSecurity,
|
|
TechSelection, RuntimeComponent, RuntimeTopology, Environment,
|
|
OperationalBaseline, ReleasePlan,
|
|
TraceabilityLink, ChangeLogEntry, ADR, DesignDocument,
|
|
Domain, UbiquitousTerm, SharedTerm, Scenario, DomainModule, DomainEntity,
|
|
]
|
|
assert len(entities) == 31
|