mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 13:18:34 -04:00
notify-admin-641 let platform admins export listing of all users (#647)
Co-authored-by: Kenneth Kehl <@kkehl@flexion.us> Co-authored-by: stvnrlly <steven.reilly@gsa.gov>
This commit is contained in:
@@ -1008,6 +1008,46 @@ def test_get_daily_volumes_report_calls_api_and_download_data(
|
||||
)
|
||||
|
||||
|
||||
def test_get_users_report(
|
||||
client_request,
|
||||
platform_admin_user,
|
||||
mocker
|
||||
):
|
||||
mocker.patch(
|
||||
"app.main.views.platform_admin.user_api_client.get_all_users",
|
||||
return_value=[{
|
||||
'name': 'Johnny Sokko',
|
||||
'organizations': [],
|
||||
'password_changed_at': '2023-07-21 14:12:54.832850', 'permissions': {
|
||||
'test service': [
|
||||
'manage_users', 'manage_templates', 'manage_settings', 'send_texts',
|
||||
'send_emails', 'manage_api_keys', 'view_activity']},
|
||||
'platform_admin': True, 'services': ['test service'], 'state': 'active'}
|
||||
]
|
||||
|
||||
|
||||
)
|
||||
|
||||
client_request.login(platform_admin_user)
|
||||
response = client_request.post_response(
|
||||
'main.get_users_report',
|
||||
_data={},
|
||||
_expected_status=200,
|
||||
)
|
||||
|
||||
assert response.content_type == 'text/csv; charset=utf-8'
|
||||
assert 'attachment' in response.headers['Content-Disposition']
|
||||
assert 'filename' in response.headers['Content-Disposition']
|
||||
assert 'User Report' in response.headers['Content-Disposition']
|
||||
|
||||
my_response = response.get_data(as_text=True)
|
||||
|
||||
assert 'Johnny Sokko' in my_response
|
||||
assert 'manage_users' in my_response
|
||||
assert 'test service' in my_response
|
||||
assert 'active' in my_response
|
||||
|
||||
|
||||
def test_get_daily_sms_provider_volumes_report_calls_api_and_download_data(
|
||||
client_request,
|
||||
platform_admin_user,
|
||||
|
||||
@@ -103,6 +103,7 @@ EXCLUDED_ENDPOINTS = tuple(map(Navigation.get_endpoint_with_blueprint, {
|
||||
'find_users_by_email',
|
||||
'forgot_password',
|
||||
'get_billing_report',
|
||||
'get_users_report',
|
||||
'get_daily_volumes',
|
||||
'get_daily_sms_provider_volumes',
|
||||
'get_volumes_by_service',
|
||||
|
||||
Reference in New Issue
Block a user