mirror of
https://github.com/kikobar/mastodon.git
synced 2024-11-19 05:37:42 +00:00
5bf67ca913
* Add HTTP signature requirement for served ActivityPub resources * Change `SECURE_MODE` to `AUTHORIZED_FETCH` * Add 'Signature' to 'Vary' header and improve code style * Improve code style by adding `public_fetch_mode?` method
30 lines
712 B
Ruby
30 lines
712 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe ActivityPub::InboxesController, type: :controller do
|
|
describe 'POST #create' do
|
|
context 'with signed_request_account' do
|
|
it 'returns 202' do
|
|
allow(controller).to receive(:signed_request_account) do
|
|
Fabricate(:account)
|
|
end
|
|
|
|
post :create, body: '{}'
|
|
expect(response).to have_http_status(202)
|
|
end
|
|
end
|
|
|
|
context 'without signed_request_account' do
|
|
it 'returns 401' do
|
|
allow(controller).to receive(:signed_request_account) do
|
|
false
|
|
end
|
|
|
|
post :create, body: '{}'
|
|
expect(response).to have_http_status(401)
|
|
end
|
|
end
|
|
end
|
|
end
|