fix(tests): backend test suite - app version, DB roles, admin RBAC, companies route, field names, DeletionLog, ABAC, imports

This commit is contained in:
Agent Zero
2026-08-08 08:09:23 +02:00
parent 1ed97d6727
commit 1b1cbc05dd
16 changed files with 457 additions and 61 deletions
+5 -1
View File
@@ -1,6 +1,7 @@
"""AuditLog model — audit trail for all create/update/delete/login actions.
Note: DeletionLog has been merged into EntityHistory (action='delete').
DeletionLog is re-exported here as an alias for backward compatibility.
"""
from __future__ import annotations
@@ -16,6 +17,10 @@ from sqlalchemy.orm import Mapped, mapped_column
from app.core.db import Base, TenantMixin
# Re-export EntityHistory as DeletionLog for backward compatibility.
# Tests import DeletionLog from app.models.audit and use entity_snapshot attribute.
from app.models.entity_history import EntityHistory as DeletionLog
class AuditLog(Base, TenantMixin):
"""Audit trail for all create/update/delete/login actions."""
@@ -35,4 +40,3 @@ class AuditLog(Base, TenantMixin):
timestamp: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, server_default=func.now(), index=True
)
+5
View File
@@ -39,3 +39,8 @@ class EntityHistory(Base, TenantMixin, OwnedMixin):
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, server_default=func.now(), index=True
)
@property
def entity_snapshot(self) -> dict[str, Any] | None:
"""Compatibility alias for snapshot_before (used by DeletionLog tests)."""
return self.snapshot_before