mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Add an event if a user is archived
This adds a new type of event, 'archive_user', which stores the id of the archived user and the id of the user who is doing the archiving.
This commit is contained in:
@@ -2,6 +2,7 @@ import uuid
|
||||
from unittest.mock import ANY
|
||||
|
||||
from app.event_handlers import (
|
||||
create_archive_user_event,
|
||||
create_email_change_event,
|
||||
create_mobile_number_change_event,
|
||||
on_user_logged_in,
|
||||
@@ -51,3 +52,18 @@ def test_create_mobile_number_change_event_calls_events_api(app_, mock_events):
|
||||
'updated_by_id': updated_by_id,
|
||||
'original_mobile_number': '07700900000',
|
||||
'new_mobile_number': '07700900999'})
|
||||
|
||||
|
||||
def test_create_archive_user_event_calls_events_api(app_, mock_events):
|
||||
user_id = str(uuid.uuid4())
|
||||
archived_by_id = str(uuid.uuid4())
|
||||
|
||||
with app_.test_request_context():
|
||||
create_archive_user_event(user_id, archived_by_id)
|
||||
|
||||
mock_events.assert_called_with('archive_user',
|
||||
{'browser_fingerprint':
|
||||
{'browser': ANY, 'version': ANY, 'platform': ANY, 'user_agent_string': ''},
|
||||
'ip_address': ANY,
|
||||
'user_id': user_id,
|
||||
'archived_by_id': archived_by_id})
|
||||
|
||||
Reference in New Issue
Block a user