Add event for remove_user_from_service

Follows our existing patterns of events for managing users
This commit is contained in:
David McDonald
2020-03-10 13:18:32 +00:00
parent 81e4902afb
commit c248fee772
4 changed files with 43 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ from app.event_handlers import (
create_archive_user_event,
create_email_change_event,
create_mobile_number_change_event,
create_remove_user_from_service_event,
on_user_logged_in,
)
from app.models.user import User
@@ -37,6 +38,26 @@ def test_create_email_change_event_calls_events_api(app_, mock_events):
'new_email_address': 'new@example.com'})
def test_create_remove_user_from_service_event_calls_events_api(app_, mock_events):
user_id = str(uuid.uuid4())
removed_by_id = str(uuid.uuid4())
service_id = str(uuid.uuid4())
with app_.test_request_context():
create_remove_user_from_service_event(user_id, removed_by_id, service_id)
mock_events.assert_called_with(
'remove_user_from_service',
{
'browser_fingerprint': {'browser': ANY, 'version': ANY, 'platform': ANY, 'user_agent_string': ''},
'ip_address': ANY,
'user_id': user_id,
'removed_by_id': removed_by_id,
'service_id': service_id,
}
)
def test_create_mobile_number_change_event_calls_events_api(app_, mock_events):
user_id = str(uuid.uuid4())
updated_by_id = str(uuid.uuid4())