X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0bd1c28bed9a0756c61037947d5a9dccd5066f00..f8af0c6c331d5b52deab50abf7afa8c7881cddfb:/services/api/test/functional/arvados/v1/repositories_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/repositories_controller_test.rb b/services/api/test/functional/arvados/v1/repositories_controller_test.rb index 0793d12e4e..5304bcafc5 100644 --- a/services/api/test/functional/arvados/v1/repositories_controller_test.rb +++ b/services/api/test/functional/arvados/v1/repositories_controller_test.rb @@ -43,17 +43,18 @@ class Arvados::V1::RepositoriesControllerTest < ActionController::TestCase end test "get_all_permissions does not give any access to user without permission" do + viewer_uuid = users(:project_viewer).uuid + assert_equal(authorized_keys(:project_viewer).authorized_user_uuid, + viewer_uuid, + "project_viewer must have an authorized_key for this test to work") authorize_with :admin get :get_all_permissions assert_response :success - assert_equal(authorized_keys(:project_viewer).authorized_user_uuid, - users(:project_viewer).uuid, - "project_viewer must have an authorized_key for this test to work") - json_response['repositories'].each do |repo| - assert_equal(false, - repo['user_permissions'].has_key?(users(:project_viewer).uuid), - "project_viewer user should not have perms for #{repo['uuid']}") + readable_repos = json_response["repositories"].select do |repo| + repo["user_permissions"].has_key?(viewer_uuid) end + assert_equal(["arvados"], readable_repos.map { |r| r["name"] }, + "project_viewer should only have permissions on public repos") end test "get_all_permissions gives gitolite R to user with read-only access" do