diff --git a/app/helpers/api_users_helper.rb b/app/helpers/api_users_helper.rb index 5627ccb15..65d3d78f4 100644 --- a/app/helpers/api_users_helper.rb +++ b/app/helpers/api_users_helper.rb @@ -8,15 +8,13 @@ def api_user_name(user) user.suspended? ? content_tag(:del, anchor_tag) : anchor_tag end - def permissions_by_application(user) + def application_list(user) content_tag(:ul, class: "govuk-list") do safe_join( visible_applications(user).map do |application| next unless user.permissions_for(application).any? - content_tag(:li) do - content_tag(:abbr, application.name, title: "Permissions: #{user.permissions_for(application).to_sentence}") - end + content_tag(:li, application.name) end, ) end diff --git a/app/views/api_users/index.html.erb b/app/views/api_users/index.html.erb index 32fc2851c..4070766db 100644 --- a/app/views/api_users/index.html.erb +++ b/app/views/api_users/index.html.erb @@ -36,7 +36,7 @@ text: user.email, }, { - text: permissions_by_application(user), + text: application_list(user), }, { text: user.suspended? ? "Yes" : "No", diff --git a/test/integration/manage_api_users_test.rb b/test/integration/manage_api_users_test.rb index 3f7524553..82b5ec7a3 100644 --- a/test/integration/manage_api_users_test.rb +++ b/test/integration/manage_api_users_test.rb @@ -19,7 +19,7 @@ class ManageApiUsersTest < ActionDispatch::IntegrationTest assert page.has_selector?("td", text: @api_user.name) assert page.has_selector?("td", text: @api_user.email) - assert page.has_selector?("abbr", text: @application.name) + assert page.has_selector?("td", text: @application.name) assert page.has_selector?("td:last-child", text: "No") # suspended? end @@ -54,16 +54,18 @@ class ManageApiUsersTest < ActionDispatch::IntegrationTest select "Managing Editor", from: "Permissions for Whitehall" click_button "Update API user" - assert page.has_selector?("abbr[title='Permissions: Managing Editor and signin']", text: "Whitehall") - click_link @api_user.name + assert_has_signin_permission_for("Whitehall") + assert_has_other_permissions("Whitehall", ["Managing Editor"]) + unselect "Managing Editor", from: "Permissions for Whitehall" click_button "Update API user" - assert page.has_selector?("abbr[title='Permissions: signin']", text: "Whitehall") - click_link @api_user.name + + assert_has_signin_permission_for("Whitehall") + click_link "Account access log" assert page.has_text?("Access token generated for Whitehall by #{@superadmin.name}") end @@ -111,4 +113,16 @@ class ManageApiUsersTest < ActionDispatch::IntegrationTest assert page.has_selector?(".alert-success", text: "#{@api_user.email} is now active.") end end + + def assert_has_signin_permission_for(application_name) + within "table#editable-permissions" do + # The existence of the