Add user transient attribute to oauth_access_token factory

This commit is contained in:
Anton Khorev 2025-01-23 17:43:30 +03:00
parent 3f62d67684
commit ef648a53ba
6 changed files with 18 additions and 14 deletions

View file

@ -26,7 +26,7 @@ class ChangesetCommentApiCapabilityTest < ActiveSupport::TestCase
end
test "as a moderator with permissionless token" do
token = create(:oauth_access_token, :resource_owner_id => create(:moderator_user).id)
token = create(:oauth_access_token, :user => create(:moderator_user))
ability = ApiAbility.new token
[:create, :destroy, :restore].each do |action|
@ -35,7 +35,7 @@ class ChangesetCommentApiCapabilityTest < ActiveSupport::TestCase
end
test "as a moderator with write_api token" do
token = create(:oauth_access_token, :resource_owner_id => create(:moderator_user).id, :scopes => %w[write_api])
token = create(:oauth_access_token, :user => create(:moderator_user), :scopes => %w[write_api])
ability = ApiAbility.new token
[:create, :destroy, :restore].each do |action|
@ -68,7 +68,7 @@ class NoteApiCapabilityTest < ActiveSupport::TestCase
end
test "as a moderator with permissionless token" do
token = create(:oauth_access_token, :resource_owner_id => create(:moderator_user).id)
token = create(:oauth_access_token, :user => create(:moderator_user))
ability = ApiAbility.new token
[:destroy].each do |action|
@ -77,7 +77,7 @@ class NoteApiCapabilityTest < ActiveSupport::TestCase
end
test "as a moderator with write_notes token" do
token = create(:oauth_access_token, :resource_owner_id => create(:moderator_user).id, :scopes => %w[write_notes])
token = create(:oauth_access_token, :user => create(:moderator_user), :scopes => %w[write_notes])
ability = ApiAbility.new token
[:destroy].each do |action|