19 lines
548 B
Python
19 lines
548 B
Python
"""sync_logs retention purge helpers."""
|
|
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
from server.infrastructure.database.sync_log_repo import (
|
|
SYNC_LOG_PURGE_BATCH_SIZE,
|
|
SYNC_LOG_RETENTION_DAYS,
|
|
)
|
|
|
|
|
|
def test_sync_log_retention_constants():
|
|
assert SYNC_LOG_RETENTION_DAYS == 30
|
|
assert SYNC_LOG_PURGE_BATCH_SIZE >= 100
|
|
|
|
|
|
def test_purge_cutoff_is_30_days_ago():
|
|
cutoff = datetime.now(timezone.utc) - timedelta(days=SYNC_LOG_RETENTION_DAYS)
|
|
assert (datetime.now(timezone.utc) - cutoff).days == SYNC_LOG_RETENTION_DAYS
|