X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6e8530d7d4c7fffe5697fe7269141f8bfef11e68..7a2e9199172a3c102e8a6c7b723fd44bc031bda4:/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb b/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb index bf407afcd7..60b4133f9a 100644 --- a/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb +++ b/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb @@ -199,8 +199,37 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes assert_not_empty(json_response['uuid']) end + [ + :active_noscope, + :active_all_collections, + :active_userlist, + :foo_collection_sharing_token, + ].each do |auth| + test "#{auth} can get current token without the appropriate scope" do + authorize_with auth + get :current + assert_response :success + end + end + test "get current token, no auth" do get :current assert_response 401 end + + # Tests regression #18801 + test "select param is respected in 'show' response" do + authorize_with :active + get :show, params: { + id: api_client_authorizations(:active).uuid, + select: ["uuid"], + } + assert_response :success + assert_raises ActiveModel::MissingAttributeError do + assigns(:object).api_token + end + assert_nil json_response["expires_at"] + assert_nil json_response["api_token"] + assert_equal api_client_authorizations(:active).uuid, json_response["uuid"] + end end