This commit is contained in:
Kenneth Kehl
2024-08-08 13:11:58 -07:00
parent ee1dcdeb03
commit 38a6c35afd
2 changed files with 34 additions and 1 deletions

View File

@@ -1254,3 +1254,36 @@ def test_get_daily_sms_provider_volumes_report_calls_api_and_download_data(
+ "80"
+ "\r\n"
)
def test_get_users_report(client_request, platform_admin_user, mocker):
mocker.patch(
"app.main.views.platform_admin.user_api_client.get_all_users_detailed",
return_value=[
{
"name": "Johnny Sokko",
"email_address": "j_sokko@unicorn.gov",
"mobile_number": "15555555555",
"service": "Emperor, Guillotine, Service",
}
],
)
client_request.login(platform_admin_user)
response = client_request.get_response(
"main.download_all_users",
_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 "users" in response.headers["Content-Disposition"]
my_response = response.get_data(as_text=True)
assert "Johnny Sokko" in my_response
assert "Emperor Guillotine Service" in my_response
assert "j_sokko@unicorn.gov" in my_response
assert "15555555555" in my_response