mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
Fix displaying of services on User Information page
This commit is contained in:
@@ -30,7 +30,9 @@ def find_users_by_email():
|
||||
@user_is_platform_admin
|
||||
def user_information(user_id):
|
||||
user = user_api_client.get_user(user_id)
|
||||
services = user_api_client.get_organisations_and_services_for_user(user)
|
||||
return render_template(
|
||||
'views/find-users/user-information.html',
|
||||
user=user
|
||||
user=user,
|
||||
services=services['services_without_organisations'],
|
||||
)
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
<h2 class="heading-medium">Services</h2>
|
||||
<nav class="browse-list">
|
||||
<ul>
|
||||
{% for service in user.services %}
|
||||
{% for service in services %}
|
||||
<li class="browse-list-item">
|
||||
<p class="browse-list-sub-item">{{ service.name }}</p>
|
||||
<p class="browse-list-hint">{{ service.name }}</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -93,11 +93,17 @@ def test_user_information_page_shows_information_about_user(
|
||||
):
|
||||
mocker.patch('app.user_api_client.get_user', side_effect=[
|
||||
platform_admin_user,
|
||||
User(user_json(name="Apple Bloom", services=[
|
||||
User(user_json(name="Apple Bloom", services=[1, 2]))
|
||||
], autospec=True)
|
||||
|
||||
mocker.patch(
|
||||
'app.user_api_client.get_organisations_and_services_for_user',
|
||||
return_value={'organisations': [], 'services_without_organisations': [
|
||||
{"id": 1, "name": "Fresh Orchard Juice"},
|
||||
{"id": 2, "name": "Nature Therapy"},
|
||||
]))
|
||||
], autospec=True)
|
||||
]},
|
||||
autospec=True
|
||||
)
|
||||
client.login(platform_admin_user)
|
||||
response = client.get(url_for('main.user_information', user_id=345))
|
||||
assert response.status_code == 200
|
||||
@@ -125,6 +131,15 @@ def test_user_information_page_displays_if_there_are_failed_login_attempts(
|
||||
platform_admin_user,
|
||||
User(user_json(name="Apple Bloom", failed_login_count=2))
|
||||
], autospec=True)
|
||||
|
||||
mocker.patch(
|
||||
'app.user_api_client.get_organisations_and_services_for_user',
|
||||
return_value={'organisations': [], 'services_without_organisations': [
|
||||
{"id": 1, "name": "Fresh Orchard Juice"},
|
||||
{"id": 2, "name": "Nature Therapy"},
|
||||
]},
|
||||
autospec=True
|
||||
)
|
||||
client.login(platform_admin_user)
|
||||
response = client.get(url_for('main.user_information', user_id=345))
|
||||
assert response.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user