Merge branch 'main' into 15814-wb2-secrets
[arvados.git] / services / api / test / factories / api_client_authorization.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 FactoryBot.define do
6   factory :api_client_authorization do
7     api_client
8     scopes { ['all'] }
9
10     trait :trusted do
11       association :api_client, factory: :api_client, is_trusted: true
12     end
13     factory :token do
14       # Just provides shorthand for "create :api_client_authorization"
15     end
16
17     to_create do |instance|
18       CurrentApiClientHelper.act_as_user instance.user do
19         instance.save!
20       end
21     end
22   end
23 end