Files
Nexus/tests/test_audit_log_purge.py
T
r 6859846b7c sync: 主项目全量同步(含 btpanel 一键登录回归修复与前端构建产物)
- bootstrap 失败恢复 SSH 临时登录回退
- ssh_bootstrap 真安装检测与 config 目录自愈
- axs Gitea 发布源切换为 https://axs.kuma1xn.vip
2026-07-08 23:52:40 +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