X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/48fce933fec998722e669d7d33a62f3c0a10b05e..1df6b1005acfdc098f6f42a384924f6879543c7b:/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 9f0f555d55..616bd07bfb 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 @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::TestCase @@ -46,7 +50,7 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes get :index, search_params assert_response :success got_tokens = JSON.parse(@response.body)['items'] - .map { |auth| auth['api_token'] } + .map { |a| a['api_token'] } assert_equal(expected_tokens.sort, got_tokens.sort, "wrong results for #{search_params.inspect}") end @@ -168,4 +172,17 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes } assert_response 403 end + + test "get current token" do + authorize_with :active + get :current + assert_response :success + assert_equal(json_response['api_token'], + api_client_authorizations(:active).api_token) + end + + test "get current token, no auth" do + get :current + assert_response 401 + end end