X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/43773cb247a1fb744b57070b715bfa5d53a00822..64c74f24fcdfbbef0e08b72c09d85c53390ca3b3:/services/api/test/unit/api_client_authorization_test.rb diff --git a/services/api/test/unit/api_client_authorization_test.rb b/services/api/test/unit/api_client_authorization_test.rb index b5b07d1f78..51a6ff3ba8 100644 --- a/services/api/test/unit/api_client_authorization_test.rb +++ b/services/api/test/unit/api_client_authorization_test.rb @@ -1,7 +1,21 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class ApiClientAuthorizationTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + include CurrentApiClient + + [:admin_trustedclient, :active_trustedclient].each do |token| + test "ApiClientAuthorization can be created then deleted by #{token}" do + set_user_from_auth token + x = ApiClientAuthorization.create!(user_id: current_user.id, + api_client_id: 0, + scopes: []) + newtoken = x.api_token + assert x.destroy, "Failed to destroy new ApiClientAuth" + assert_empty ApiClientAuthorization.where(api_token: newtoken), "Destroyed ApiClientAuth is still in database" + end + end end