X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2f66d4cc05e9442a9bb69969744d0750a02a1ed4..c4d1131613de217719929ff05a06f19321cb5fdc:/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 c2c71ca540..9c70f6f417 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 @@ -81,6 +81,15 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes end end + [:admin, :active].each do |token| + test "using '#{token}', get token details via 'current'" do + authorize_with token + get :current + assert_response 200 + assert_equal json_response['scopes'], ['all'] + end + end + [# anyone can look up the token they're currently using [:admin, :admin, 200, 200, 1], [:active, :active, 200, 200, 1], @@ -194,4 +203,20 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes 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