chore: snapshot workflow migration progress
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
"""Tests for notification config service."""
|
||||
import pytest
|
||||
from sqlalchemy import select
|
||||
|
||||
from app.domains.notifications.models import AuditLog
|
||||
from app.domains.notifications.service import (
|
||||
emit_notification,
|
||||
upsert_notification_config,
|
||||
get_notification_configs,
|
||||
)
|
||||
@@ -25,3 +29,25 @@ async def test_upsert_updates_existing(db, admin_user):
|
||||
cfg = next((c for c in configs if c.event_type == "order_submitted"), None)
|
||||
assert cfg is not None
|
||||
assert cfg.enabled is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_emit_notification_persists_naive_utc_timestamp(db, admin_user):
|
||||
"""Notification writes must match the legacy naive Postgres timestamp columns."""
|
||||
await emit_notification(
|
||||
db,
|
||||
actor_user_id=admin_user.id,
|
||||
target_user_id=admin_user.id,
|
||||
action="order.submitted",
|
||||
entity_type="order",
|
||||
entity_id="order-123",
|
||||
details={"order_number": "SA-2026-00001"},
|
||||
)
|
||||
|
||||
row = (
|
||||
await db.execute(
|
||||
select(AuditLog).where(AuditLog.action == "order.submitted")
|
||||
)
|
||||
).scalar_one()
|
||||
|
||||
assert row.timestamp.tzinfo is None
|
||||
|
||||
Reference in New Issue
Block a user