Files
Nexus/tests/test_audit_log_purge.py
T
2026-07-08 22:31:31 +08:00

22 lines
623 B
Python

"""audit_logs retention purge helpers."""
from datetime import datetime, timedelta, timezone
from server.infrastructure.database.audit_log_repo import (
AUDIT_LOG_PURGE_BATCH_SIZE,
AUDIT_LOG_RETENTION_DAYS,
)
def test_audit_log_retention_constants():
assert AUDIT_LOG_RETENTION_DAYS == 7
assert AUDIT_LOG_PURGE_BATCH_SIZE >= 100
def test_purge_cutoff_is_7_days_ago():
cutoff = datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(
days=AUDIT_LOG_RETENTION_DAYS
)
age = datetime.now(timezone.utc).replace(tzinfo=None) - cutoff
assert age.days == AUDIT_LOG_RETENTION_DAYS