Merge commit '9c2d5b534f
' into upstream-20250314
This commit is contained in:
commit
6548462ecb
84 changed files with 1719 additions and 418 deletions
19
spec/requests/admin/settings/branding_spec.rb
Normal file
19
spec/requests/admin/settings/branding_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin Settings Branding' do
|
||||
describe 'When signed in as an admin' do
|
||||
before { sign_in Fabricate(:admin_user) }
|
||||
|
||||
describe 'PUT /admin/settings/branding' do
|
||||
it 'cannot create a setting value for a non-admin key' do
|
||||
expect { put admin_settings_branding_path, params: { form_admin_settings: { new_setting_key: 'New key value' } } }
|
||||
.to_not change(Setting, :new_setting_key).from(nil)
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -53,8 +53,6 @@ RSpec.describe 'credentials API' do
|
|||
patch '/api/v1/accounts/update_credentials', headers: headers, params: params
|
||||
end
|
||||
|
||||
before { allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async) }
|
||||
|
||||
let(:params) do
|
||||
{
|
||||
avatar: fixture_file_upload('avatar.gif', 'image/gif'),
|
||||
|
@ -113,7 +111,7 @@ RSpec.describe 'credentials API' do
|
|||
})
|
||||
|
||||
expect(ActivityPub::UpdateDistributionWorker)
|
||||
.to have_received(:perform_async).with(user.account_id)
|
||||
.to have_enqueued_sidekiq_job(user.account_id)
|
||||
end
|
||||
|
||||
def expect_account_updates
|
||||
|
|
|
@ -15,10 +15,6 @@ RSpec.describe 'Deleting profile images' do
|
|||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
|
||||
describe 'DELETE /api/v1/profile' do
|
||||
before do
|
||||
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
||||
end
|
||||
|
||||
context 'when deleting an avatar' do
|
||||
context 'with wrong scope' do
|
||||
before do
|
||||
|
@ -38,7 +34,8 @@ RSpec.describe 'Deleting profile images' do
|
|||
account.reload
|
||||
expect(account.avatar).to_not exist
|
||||
expect(account.header).to exist
|
||||
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
|
||||
expect(ActivityPub::UpdateDistributionWorker)
|
||||
.to have_enqueued_sidekiq_job(account.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -61,7 +58,8 @@ RSpec.describe 'Deleting profile images' do
|
|||
account.reload
|
||||
expect(account.avatar).to exist
|
||||
expect(account.header).to_not exist
|
||||
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
|
||||
expect(ActivityPub::UpdateDistributionWorker)
|
||||
.to have_enqueued_sidekiq_job(account.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,7 @@ RSpec.describe 'API V1 Push Subscriptions' do
|
|||
subscription: {
|
||||
endpoint: endpoint,
|
||||
keys: keys,
|
||||
standard: standard,
|
||||
},
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
@ -36,6 +37,7 @@ RSpec.describe 'API V1 Push Subscriptions' do
|
|||
},
|
||||
}.with_indifferent_access
|
||||
end
|
||||
let(:standard) { '1' }
|
||||
let(:scopes) { 'push' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
|
@ -66,6 +68,7 @@ RSpec.describe 'API V1 Push Subscriptions' do
|
|||
user_id: eq(user.id),
|
||||
access_token_id: eq(token.id)
|
||||
)
|
||||
.and be_standard
|
||||
|
||||
expect(response.parsed_body.with_indifferent_access)
|
||||
.to include(
|
||||
|
@ -73,6 +76,17 @@ RSpec.describe 'API V1 Push Subscriptions' do
|
|||
)
|
||||
end
|
||||
|
||||
context 'when standard is provided as false value' do
|
||||
let(:standard) { '0' }
|
||||
|
||||
it 'saves push subscription with standard as false' do
|
||||
subject
|
||||
|
||||
expect(endpoint_push_subscription)
|
||||
.to_not be_standard
|
||||
end
|
||||
end
|
||||
|
||||
it 'replaces old subscription on repeat calls' do
|
||||
2.times { subject }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue