mirror of
https://github.com/simple-login/app.git
synced 2025-09-06 22:54:42 +08:00
* feat: added abuser utils for main abuser (un)archiving flows. * feat: update the abuser utils to use external secrets in conjuction with HMAC; add abuser audit log. * fix: revert the DB_URI part. * feat: address feedback. * feat: address feedback. * feat: address feedback. * feat: address feedback. * feat: address feedback.
27 lines
812 B
Python
27 lines
812 B
Python
from typing import List
|
|
|
|
from app.abuser_audit_log_utils import emit_abuser_audit_log, AbuserAuditLogAction
|
|
from app.models import AbuserAuditLog
|
|
from app.utils import random_string
|
|
from tests.utils import create_new_user
|
|
|
|
|
|
def test_emit_abuser_audit_log_for_random_data():
|
|
user = create_new_user()
|
|
|
|
message = random_string()
|
|
action = AbuserAuditLogAction.MarkAbuser
|
|
emit_abuser_audit_log(
|
|
user_id=user.id,
|
|
action=action,
|
|
message=message,
|
|
commit=True,
|
|
)
|
|
|
|
logs_for_user: List[AbuserAuditLog] = AbuserAuditLog.filter_by(
|
|
user_id=user.id, action=action.value
|
|
).all()
|
|
assert len(logs_for_user) == 1
|
|
assert logs_for_user[0].user_id == user.id
|
|
assert logs_for_user[0].action == action.value
|
|
assert logs_for_user[0].message == message
|