1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class ApiClientAuthorizationTest < ActiveSupport::TestCase
8 include CurrentApiClient
10 [:admin_trustedclient, :active_trustedclient].each do |token|
11 test "ApiClientAuthorization can be created then deleted by #{token}" do
12 set_user_from_auth token
13 x = ApiClientAuthorization.create!(user_id: current_user.id,
16 newtoken = x.api_token
17 assert x.destroy, "Failed to destroy new ApiClientAuth"
18 assert_empty ApiClientAuthorization.where(api_token: newtoken), "Destroyed ApiClientAuth is still in database"