mirror of
https://github.com/mastodon/mastodon
synced 2024-12-12 21:58:20 +09:00
b7370ac8ba
* Deliver ActivityPub Like * Deliver ActivityPub Undo-Like * Deliver ActivityPub Create/Announce activities * Deliver ActivityPub creates from mentions * Deliver ActivityPub Block/Undo-Block * Deliver ActivityPub Accept/Reject-Follow * Deliver ActivityPub Undo-Follow * Deliver ActivityPub Follow * Deliver ActivityPub Delete activities Incidentally fix #889 * Adjust BatchedRemoveStatusService for ActivityPub * Add tests for ActivityPub workers * Add tests for FollowService * Add tests for FavouriteService, UnfollowService and PostStatusService * Add tests for ReblogService, BlockService, UnblockService, ProcessMentionsService * Add tests for AuthorizeFollowService, RejectFollowService, RemoveStatusService * Add tests for BatchedRemoveStatusService * Deliver updates to a local account to ActivityPub followers * Minor adjustments
62 lines
1.8 KiB
Ruby
62 lines
1.8 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe Api::V1::Accounts::CredentialsController do
|
|
render_views
|
|
|
|
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write') }
|
|
|
|
before do
|
|
allow(controller).to receive(:doorkeeper_token) { token }
|
|
end
|
|
|
|
describe 'GET #show' do
|
|
it 'returns http success' do
|
|
get :show
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
end
|
|
|
|
describe 'PATCH #update' do
|
|
describe 'with valid data' do
|
|
before do
|
|
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
|
|
|
patch :update, params: {
|
|
display_name: "Alice Isn't Dead",
|
|
note: "Hi!\n\nToot toot!",
|
|
avatar: fixture_file_upload('files/avatar.gif', 'image/gif'),
|
|
header: fixture_file_upload('files/attachment.jpg', 'image/jpeg'),
|
|
}
|
|
end
|
|
|
|
it 'returns http success' do
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
|
|
it 'updates account info' do
|
|
user.account.reload
|
|
|
|
expect(user.account.display_name).to eq("Alice Isn't Dead")
|
|
expect(user.account.note).to eq("Hi!\n\nToot toot!")
|
|
expect(user.account.avatar).to exist
|
|
expect(user.account.header).to exist
|
|
end
|
|
|
|
it 'queues up an account update distribution' do
|
|
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(user.account_id)
|
|
end
|
|
end
|
|
|
|
describe 'with invalid data' do
|
|
before do
|
|
patch :update, params: { note: 'This is too long. ' * 10 }
|
|
end
|
|
|
|
it 'returns http unprocessable entity' do
|
|
expect(response).to have_http_status(:unprocessable_entity)
|
|
end
|
|
end
|
|
end
|
|
end
|