Merge remote-tracking branch 'origin/master' into gs-master

Conflicts:
 	.travis.yml
 	Gemfile.lock
 	README.md
 	app/controllers/settings/follower_domains_controller.rb
 	app/controllers/statuses_controller.rb
 	app/javascript/mastodon/locales/ja.json
 	app/lib/feed_manager.rb
 	app/models/media_attachment.rb
 	app/models/mute.rb
 	app/models/status.rb
 	app/services/mute_service.rb
 	app/views/home/index.html.haml
 	app/views/stream_entries/_simple_status.html.haml
 	config/locales/ca.yml
 	config/locales/en.yml
 	config/locales/es.yml
 	config/locales/fr.yml
 	config/locales/nl.yml
 	config/locales/pl.yml
 	config/locales/pt-BR.yml
 	config/themes.yml
This commit is contained in:
David Yip
2018-05-03 17:23:44 -05:00
437 changed files with 5999 additions and 1848 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ RSpec.describe AboutController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -35,7 +35,7 @@ RSpec.describe AboutController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -49,7 +49,7 @@ RSpec.describe AboutController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
+1 -1
View File
@@ -40,7 +40,7 @@ RSpec.describe AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns correct format' do
@@ -13,7 +13,7 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns application/activity+json' do
@@ -63,7 +63,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'returns http success' do
get :index
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -72,7 +72,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'returns http success' do
get :show, params: { id: account.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -16,7 +16,7 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
get :show, params: { account_id: account.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -20,14 +20,14 @@ RSpec.describe Admin::ConfirmationsController, type: :controller do
it 'raises an error when there is no account' do
post :create, params: { account_id: 'fake' }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
it 'raises an error when there is no user' do
account = Fabricate(:account, user: nil)
post :create, params: { account_id: account.id }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -23,7 +23,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
assigned = assigns(:domain_blocks)
expect(assigned.count).to eq 1
expect(assigned.klass).to be DomainBlock
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -32,7 +32,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
get :new
expect(assigns(:domain_block)).to be_instance_of(DomainBlock)
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -41,7 +41,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
domain_block = Fabricate(:domain_block)
get :show, params: { id: domain_block.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -25,7 +25,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do
assigned = assigns(:email_domain_blocks)
expect(assigned.count).to eq 1
expect(assigned.klass).to be EmailDomainBlock
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -34,7 +34,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do
get :new
expect(assigns(:email_domain_block)).to be_instance_of(EmailDomainBlock)
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -26,7 +26,7 @@ RSpec.describe Admin::InstancesController, type: :controller do
expect(instances.size).to eq 1
expect(instances[0].domain).to eq 'less.popular'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -13,7 +13,7 @@ describe Admin::ReportedStatusesController do
describe 'POST #create' do
subject do
-> { post :create, params: { report_id: report, form_status_batch: { action: action, status_ids: status_ids } } }
-> { post :create, params: { :report_id => report, action => '', :form_status_batch => { status_ids: status_ids } } }
end
let(:action) { 'nsfw_on' }
@@ -84,7 +84,7 @@ describe Admin::ReportedStatusesController do
allow(RemovalWorker).to receive(:perform_async)
delete :destroy, params: { report_id: report, id: status }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(RemovalWorker).
to have_received(:perform_async).with(status.id)
end
@@ -18,7 +18,7 @@ describe Admin::ReportsController do
reports = assigns(:reports).to_a
expect(reports.size).to eq 1
expect(reports[0]).to eq specified
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns http success with resolved filter' do
@@ -31,7 +31,7 @@ describe Admin::ReportsController do
expect(reports.size).to eq 1
expect(reports[0]).to eq specified
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -42,7 +42,7 @@ describe Admin::ReportsController do
get :show, params: { id: report }
expect(assigns(:report)).to eq report
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -52,7 +52,7 @@ describe Admin::ReportsController do
report = Fabricate(:report)
put :update, params: { id: report, outcome: 'unknown' }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
@@ -14,7 +14,7 @@ RSpec.describe Admin::SettingsController, type: :controller do
it 'returns http success' do
get :edit
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -20,7 +20,7 @@ describe Admin::StatusesController do
statuses = assigns(:statuses).to_a
expect(statuses.size).to eq 2
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns http success with media' do
@@ -28,7 +28,7 @@ describe Admin::StatusesController do
statuses = assigns(:statuses).to_a
expect(statuses.size).to eq 1
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -99,7 +99,7 @@ describe Admin::StatusesController do
allow(RemovalWorker).to receive(:perform_async)
delete :destroy, params: { account_id: account.id, id: status }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(RemovalWorker).
to have_received(:perform_async).with(status.id)
end
@@ -26,7 +26,7 @@ RSpec.describe Admin::SubscriptionsController, type: :controller do
expect(subscriptions.count).to eq 1
expect(subscriptions[0]).to eq specified
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
+1 -1
View File
@@ -23,7 +23,7 @@ describe Api::BaseController do
it 'does not protect from forgery' do
ActionController::Base.allow_forgery_protection = true
post 'success'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -13,7 +13,7 @@ RSpec.describe Api::OEmbedController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
+2 -2
View File
@@ -23,7 +23,7 @@ RSpec.describe Api::PushController, type: :controller do
'3600',
nil
)
expect(response).to have_http_status(:success)
expect(response).to have_http_status(202)
end
end
@@ -43,7 +43,7 @@ RSpec.describe Api::PushController, type: :controller do
account,
'https://callback.host/api',
)
expect(response).to have_http_status(:success)
expect(response).to have_http_status(202)
end
end
@@ -24,7 +24,7 @@ RSpec.describe Api::SalmonController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(202)
end
it 'creates remote account' do
@@ -12,7 +12,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'echoes back the challenge' do
@@ -27,7 +27,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -59,7 +59,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates statuses for feed' do
@@ -14,7 +14,7 @@ describe Api::V1::Accounts::CredentialsController do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -36,7 +36,7 @@ describe Api::V1::Accounts::CredentialsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates account info' do
@@ -15,7 +15,7 @@ describe Api::V1::Accounts::FollowerAccountsController do
it 'returns http success' do
get :index, params: { account_id: user.account.id, limit: 1 }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -15,7 +15,7 @@ describe Api::V1::Accounts::FollowingAccountsController do
it 'returns http success' do
get :index, params: { account_id: user.account.id, limit: 1 }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -17,7 +17,7 @@ describe Api::V1::Accounts::ListsController do
describe 'GET #index' do
it 'returns http success' do
get :index, params: { account_id: account.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -25,7 +25,7 @@ describe Api::V1::Accounts::RelationshipsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns JSON with correct data' do
@@ -43,7 +43,7 @@ describe Api::V1::Accounts::RelationshipsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns JSON with correct data' do
@@ -14,7 +14,7 @@ RSpec.describe Api::V1::Accounts::SearchController, type: :controller do
it 'returns http success' do
get :show, params: { q: 'query' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -15,7 +15,7 @@ describe Api::V1::Accounts::StatusesController do
it 'returns http success' do
get :index, params: { account_id: user.account.id, limit: 1 }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
@@ -23,7 +23,7 @@ describe Api::V1::Accounts::StatusesController do
it 'returns http success' do
get :index, params: { account_id: user.account.id, only_media: true }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -35,7 +35,7 @@ describe Api::V1::Accounts::StatusesController do
it 'returns http success' do
get :index, params: { account_id: user.account.id, exclude_replies: true }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -47,7 +47,7 @@ describe Api::V1::Accounts::StatusesController do
it 'returns http success' do
get :index, params: { account_id: user.account.id, pinned: true }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -13,7 +13,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
describe 'GET #show' do
it 'returns http success' do
get :show, params: { id: user.account.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -28,7 +28,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
let(:locked) { false }
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns JSON with following=true and requested=false' do
@@ -47,7 +47,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
let(:locked) { true }
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns JSON with following=false and requested=true' do
@@ -72,7 +72,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes the following relation between user and target user' do
@@ -89,7 +89,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes the following relation between user and target user' do
@@ -110,7 +110,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes the blocking relation between user and target user' do
@@ -127,7 +127,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'does not remove the following relation between user and target user' do
@@ -152,7 +152,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'does not remove the following relation between user and target user' do
@@ -177,7 +177,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes the muting relation between user and target user' do
@@ -16,7 +16,7 @@ describe Api::V1::Apps::CredentialsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'does not contain client credentials' do
@@ -9,7 +9,7 @@ RSpec.describe Api::V1::AppsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates an OAuth app' do
@@ -47,7 +47,7 @@ RSpec.describe Api::V1::BlocksController, type: :controller do
it 'returns http success' do
get :index
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -12,7 +12,7 @@ RSpec.describe Api::V1::CustomEmojisController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -17,7 +17,7 @@ RSpec.describe Api::V1::DomainBlocksController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns blocked domains' do
@@ -31,7 +31,7 @@ RSpec.describe Api::V1::DomainBlocksController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates a domain block' do
@@ -45,7 +45,7 @@ RSpec.describe Api::V1::DomainBlocksController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'deletes a domain block' do
@@ -18,7 +18,7 @@ RSpec.describe Api::V1::FollowRequestsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -28,7 +28,7 @@ RSpec.describe Api::V1::FollowRequestsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'allows follower to follow' do
@@ -42,7 +42,7 @@ RSpec.describe Api::V1::FollowRequestsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes follow request' do
@@ -24,7 +24,7 @@ RSpec.describe Api::V1::FollowsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates account for remote user' do
@@ -45,7 +45,7 @@ RSpec.describe Api::V1::FollowsController, type: :controller do
it 'returns http success if already following, too' do
post :create, params: { uri: 'gargron@quitter.no' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -16,7 +16,7 @@ RSpec.describe Api::V1::InstancesController, type: :controller do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -17,7 +17,7 @@ describe Api::V1::Lists::AccountsController do
it 'returns http success' do
get :show, params: { list_id: list.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -30,7 +30,7 @@ describe Api::V1::Lists::AccountsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'adds account to the list' do
@@ -44,7 +44,7 @@ describe Api::V1::Lists::AccountsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes account from the list' do
@@ -12,14 +12,14 @@ RSpec.describe Api::V1::ListsController, type: :controller do
describe 'GET #index' do
it 'returns http success' do
get :index
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
describe 'GET #show' do
it 'returns http success' do
get :show, params: { id: list.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -29,7 +29,7 @@ RSpec.describe Api::V1::ListsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates list' do
@@ -44,7 +44,7 @@ RSpec.describe Api::V1::ListsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the list' do
@@ -58,7 +58,7 @@ RSpec.describe Api::V1::ListsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'deletes the list' do
@@ -30,7 +30,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
it 'returns http 422' do
expect(response).to have_http_status(:error)
expect(response).to have_http_status(500)
end
end
end
@@ -41,7 +41,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates a media attachment' do
@@ -63,7 +63,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates a media attachment' do
@@ -85,7 +85,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
end
xit 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
xit 'creates a media attachment' do
@@ -15,7 +15,7 @@ RSpec.describe Api::V1::MutesController, type: :controller do
it 'returns http success' do
get :index, params: { limit: 1 }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -16,7 +16,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
notification = Fabricate(:notification, account: user.account)
get :show, params: { id: notification.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -25,7 +25,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
notification = Fabricate(:notification, account: user.account)
post :dismiss, params: { id: notification.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect { notification.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -36,7 +36,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
post :clear
expect(notification.account.reload.notifications).to be_empty
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -56,7 +56,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'includes reblog' do
@@ -82,7 +82,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'includes reblog' do
@@ -16,7 +16,7 @@ RSpec.describe Api::V1::ReportsController, type: :controller do
it 'returns http success' do
get :index
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -31,7 +31,7 @@ RSpec.describe Api::V1::ReportsController, type: :controller do
it 'creates a report' do
expect(status.reload.account.targeted_reports).not_to be_empty
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'sends e-mails to admins' do
@@ -16,7 +16,7 @@ RSpec.describe Api::V1::SearchController, type: :controller do
it 'returns http success' do
get :index, params: { q: 'test' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -21,7 +21,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
it 'returns http success' do
get :index, params: { status_id: status.id, limit: 1 }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
end
@@ -43,7 +43,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
it 'returns http unautharized' do
get :index, params: { status_id: status.id }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -58,7 +58,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
it 'returns http success' do
get :index, params: { status_id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -22,7 +22,7 @@ describe Api::V1::Statuses::FavouritesController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the favourites count' do
@@ -51,7 +51,7 @@ describe Api::V1::Statuses::FavouritesController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the favourites count' do
@@ -22,7 +22,7 @@ describe Api::V1::Statuses::MutesController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'creates a conversation mute' do
@@ -39,7 +39,7 @@ describe Api::V1::Statuses::MutesController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'destroys the conversation mute' do
@@ -22,7 +22,7 @@ describe Api::V1::Statuses::PinsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the pinned attribute' do
@@ -46,7 +46,7 @@ describe Api::V1::Statuses::PinsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the pinned attribute' do
@@ -21,7 +21,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll
it 'returns http success' do
get :index, params: { status_id: status.id, limit: 1 }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
end
@@ -42,7 +42,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll
it 'returns http unautharized' do
get :index, params: { status_id: status.id }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -57,7 +57,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll
it 'returns http success' do
get :index, params: { status_id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -22,7 +22,7 @@ describe Api::V1::Statuses::ReblogsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the reblogs count' do
@@ -51,7 +51,7 @@ describe Api::V1::Statuses::ReblogsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'updates the reblogs count' do
@@ -17,7 +17,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
it 'returns http success' do
get :show, params: { id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -30,7 +30,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
it 'returns http success' do
get :context, params: { id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -40,7 +40,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -52,7 +52,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'removes the status' do
@@ -72,7 +72,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
describe 'GET #show' do
it 'returns http unautharized' do
get :show, params: { id: status.id }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
@@ -83,14 +83,14 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
it 'returns http unautharized' do
get :context, params: { id: status.id }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
describe 'GET #card' do
it 'returns http unautharized' do
get :card, params: { id: status.id }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -101,7 +101,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
describe 'GET #show' do
it 'returns http success' do
get :show, params: { id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -112,14 +112,14 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
it 'returns http success' do
get :context, params: { id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
describe 'GET #card' do
it 'returns http success' do
get :card, params: { id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -23,7 +23,7 @@ describe Api::V1::Timelines::HomeController do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
end
@@ -24,7 +24,7 @@ describe Api::V1::Timelines::ListController do
it 'returns http success' do
get :show, params: { id: list.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -22,7 +22,7 @@ describe Api::V1::Timelines::PublicController do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
end
@@ -35,7 +35,7 @@ describe Api::V1::Timelines::PublicController do
it 'returns http success' do
get :show, params: { local: true }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
end
@@ -48,7 +48,7 @@ describe Api::V1::Timelines::PublicController do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link']).to be_nil
end
end
@@ -21,7 +21,7 @@ describe Api::V1::Timelines::TagController do
it 'returns http success' do
get :show, params: { id: 'test' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link'].links.size).to eq(2)
end
end
@@ -33,7 +33,7 @@ describe Api::V1::Timelines::TagController do
describe 'GET #show' do
it 'returns http success' do
get :show, params: { id: 'test' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.headers['Link']).to be_nil
end
end
@@ -13,7 +13,7 @@ describe Api::Web::SettingsController do
patch :update, format: :json, params: { data: { 'onboarded' => true } }
user.reload
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(user_web_setting.data['onboarded']).to eq('true')
end
@@ -51,7 +51,7 @@ describe ApplicationController, type: :controller do
routes.draw { get 'success' => 'anonymous#success' }
allow(Rails.env).to receive(:production?).and_return(false)
get 'success'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it "forces ssl if Rails.env.production? is 'true'" do
@@ -145,13 +145,13 @@ describe ApplicationController, type: :controller do
it 'does nothing if not signed in' do
get 'success'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'does nothing if user who signed in is not suspended' do
sign_in(Fabricate(:user, account: Fabricate(:account, suspended: false)))
get 'success'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'returns http 403 if user who signed in is suspended' do
@@ -7,7 +7,7 @@ describe Auth::ConfirmationsController, type: :controller do
it 'returns http success' do
@request.env['devise.mapping'] = Devise.mappings[:user]
get :new
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -9,7 +9,7 @@ describe Auth::PasswordsController, type: :controller do
it 'returns http success' do
@request.env['devise.mapping'] = Devise.mappings[:user]
get :new
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -24,7 +24,7 @@ describe Auth::PasswordsController, type: :controller do
context 'with valid reset_password_token' do
it 'returns http success' do
get :edit, params: { reset_password_token: @token }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -35,7 +35,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
request.env["devise.mapping"] = Devise.mappings[:user]
sign_in(Fabricate(:user))
get :edit
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -44,7 +44,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
request.env["devise.mapping"] = Devise.mappings[:user]
sign_in(Fabricate(:user), scope: :user)
post :update
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -63,7 +63,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
it 'returns http success' do
Setting.open_registrations = true
get :new
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -73,6 +73,12 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'POST #create' do
let(:accept_language) { Rails.application.config.i18n.available_locales.sample.to_s }
around do |example|
current_locale = I18n.locale
example.run
I18n.locale = current_locale
end
before { request.env["devise.mapping"] = Devise.mappings[:user] }
context do
@@ -12,7 +12,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
it 'returns http success' do
get :new
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -47,7 +47,7 @@ describe AuthorizeFollowsController do
get :show, params: { acct: 'http://example.com' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(assigns(:account)).to eq account
end
@@ -59,7 +59,7 @@ describe AuthorizeFollowsController do
get :show, params: { acct: 'acct:found@hostname' }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(assigns(:account)).to eq account
end
end
@@ -39,7 +39,7 @@ describe ApplicationController, type: :controller do
it 'returns http success' do
account = Fabricate(:account)
get 'success', params: { account_username: account.username }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -19,7 +19,7 @@ describe ApplicationController, type: :controller do
sign_in user
get :index, format: :csv
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.content_type).to eq 'text/csv'
expect(response.headers['Content-Disposition']).to eq 'attachment; filename="anonymous.csv"'
expect(response.body).to eq user.account.username
+6 -2
View File
@@ -11,13 +11,17 @@ describe ApplicationController, type: :controller do
end
end
around do |example|
current_locale = I18n.locale
example.run
I18n.locale = current_locale
end
before do
routes.draw { get 'success' => 'anonymous#success' }
end
shared_examples 'default locale' do
after { I18n.locale = I18n.default_locale }
it 'sets available and preferred language' do
request.headers['Accept-Language'] = 'ca-ES, fa'
get 'success'
@@ -19,7 +19,7 @@ describe FollowerAccountsController do
expect(assigned[0]).to eq follow1
expect(assigned[1]).to eq follow0
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -19,7 +19,7 @@ describe FollowingAccountsController do
expect(assigned[0]).to eq follow1
expect(assigned[1]).to eq follow0
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
@@ -9,7 +9,7 @@ describe ManifestsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
+3 -3
View File
@@ -18,13 +18,13 @@ describe MediaController do
media_attachment = Fabricate(:media_attachment, status: nil)
get :show, params: { id: media_attachment.to_param }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
it 'raises when shortcode cant be found' do
get :show, params: { id: 'missing' }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
it 'raises when not permitted to view' do
@@ -33,7 +33,7 @@ describe MediaController do
allow_any_instance_of(MediaController).to receive(:authorize).and_raise(ActiveRecord::RecordNotFound)
get :show, params: { id: media_attachment.to_param }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -26,7 +26,7 @@ RSpec.describe Oauth::AuthorizationsController, type: :controller do
it 'returns http success' do
subject
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'gives options to authorize and deny' do
@@ -24,7 +24,7 @@ describe Oauth::AuthorizedApplicationsController do
it 'returns http success' do
subject
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
include_examples 'stores location for user'
@@ -10,7 +10,7 @@ describe RemoteFollowController do
account = Fabricate(:account)
get :new, params: { account_username: account.to_param }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response).to render_template(:new)
expect(assigns(:remote_follow).acct).to be_nil
end
@@ -20,7 +20,7 @@ describe RemoteFollowController do
account = Fabricate(:account)
get :new, params: { account_username: account.to_param }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response).to render_template(:new)
expect(assigns(:remote_follow).acct).to eq 'user@example.com'
end
@@ -15,7 +15,7 @@ describe Settings::ApplicationsController do
it 'shows apps' do
get :index
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(assigns(:applications)).to include(app)
expect(assigns(:applications)).to_not include(other_app)
end
@@ -25,7 +25,7 @@ describe Settings::ApplicationsController do
describe 'GET #show' do
it 'returns http success' do
get :show, params: { id: app.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(assigns[:application]).to eql(app)
end
@@ -40,7 +40,7 @@ describe Settings::ApplicationsController do
describe 'GET #new' do
it 'works' do
get :new
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -102,7 +102,7 @@ describe Settings::ApplicationsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'renders form again' do
@@ -151,7 +151,7 @@ describe Settings::ApplicationsController do
end
it 'returns http success' do
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'renders form again' do
@@ -13,7 +13,7 @@ describe Settings::DeletesController do
it 'renders confirmation page' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -17,7 +17,7 @@ describe Settings::ExportsController do
export = assigns(:export)
expect(export).to be_instance_of Export
expect(export.account).to eq user.account
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -36,7 +36,7 @@ describe Settings::FollowerDomainsController do
it 'returns http success' do
sign_in user, scope: :user
subject
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
include_examples 'authenticate user'
@@ -10,7 +10,7 @@ RSpec.describe Settings::ImportsController, type: :controller do
describe "GET #show" do
it "returns http success" do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -12,7 +12,7 @@ describe Settings::NotificationsController do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -12,7 +12,7 @@ describe Settings::PreferencesController do
describe 'GET #show' do
it 'returns http success' do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -11,7 +11,7 @@ RSpec.describe Settings::ProfilesController, type: :controller do
describe "GET #show" do
it "returns http success" do
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -15,7 +15,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
expect(assigns(:confirmation)).to be_instance_of Form::TwoFactorConfirmation
expect(assigns(:provision_url)).to eq 'otpauth://totp/local-part@domain?secret=thisisasecretforthespecofnewview&issuer=cb6e6126.ngrok.io'
expect(assigns(:qrcode)).to be_instance_of RQRCode::QRCode
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response).to render_template(:new)
end
end
@@ -71,7 +71,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
expect(assigns(:recovery_codes)).to eq otp_backup_codes
expect(flash[:notice]).to eq 'Two-factor authentication successfully enabled'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response).to render_template('settings/two_factor_authentication/recovery_codes/index')
end
end
@@ -19,7 +19,7 @@ describe Settings::TwoFactorAuthentication::RecoveryCodesController do
expect(assigns(:recovery_codes)).to eq otp_backup_codes
expect(flash[:notice]).to eq 'Recovery codes successfully regenerated'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response).to render_template(:index)
end
@@ -18,7 +18,7 @@ describe Settings::TwoFactorAuthenticationsController do
user.update(otp_required_for_login: true)
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
@@ -27,7 +27,7 @@ describe Settings::TwoFactorAuthenticationsController do
user.update(otp_required_for_login: false)
get :show
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
end
+44 -1
View File
@@ -82,10 +82,53 @@ describe StatusesController do
expect(assigns(:ancestors)).to eq []
end
it 'assigns @descendant_threads for a thread with several statuses' do
status = Fabricate(:status)
child = Fabricate(:status, in_reply_to_id: status.id)
grandchild = Fabricate(:status, in_reply_to_id: child.id)
get :show, params: { account_username: status.account.username, id: status.id }
expect(assigns(:descendant_threads)[0][:statuses].pluck(:id)).to eq [child.id, grandchild.id]
end
it 'assigns @descendant_threads for several threads sharing the same descendant' do
status = Fabricate(:status)
child = Fabricate(:status, in_reply_to_id: status.id)
grandchildren = 2.times.map { Fabricate(:status, in_reply_to_id: child.id) }
get :show, params: { account_username: status.account.username, id: status.id }
expect(assigns(:descendant_threads)[0][:statuses].pluck(:id)).to eq [child.id, grandchildren[0].id]
expect(assigns(:descendant_threads)[1][:statuses].pluck(:id)).to eq [grandchildren[1].id]
end
it 'assigns @max_descendant_thread_id for the last thread if it is hitting the status limit' do
stub_const 'StatusesController::DESCENDANTS_LIMIT', 1
status = Fabricate(:status)
child = Fabricate(:status, in_reply_to_id: status.id)
get :show, params: { account_username: status.account.username, id: status.id }
expect(assigns(:descendant_threads)).to eq []
expect(assigns(:max_descendant_thread_id)).to eq child.id
end
it 'assigns @descendant_threads for threads with :next_status key if they are hitting the depth limit' do
stub_const 'StatusesController::DESCENDANTS_DEPTH_LIMIT', 1
status = Fabricate(:status)
child = Fabricate(:status, in_reply_to_id: status.id)
get :show, params: { account_username: status.account.username, id: status.id }
expect(assigns(:descendant_threads)[0][:statuses].pluck(:id)).not_to include child.id
expect(assigns(:descendant_threads)[0][:next_status].id).to eq child.id
end
it 'returns a success' do
status = Fabricate(:status)
get :show, params: { account_username: status.account.username, id: status.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'renders stream_entries/show' do
@@ -77,7 +77,7 @@ RSpec.describe StreamEntriesController, type: :controller do
it 'returns http success with Atom' do
status = Fabricate(:status)
get :show, params: { account_username: status.account.username, id: status.stream_entry.id }, format: 'atom'
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
end
+2 -2
View File
@@ -12,7 +12,7 @@ RSpec.describe TagsController, type: :controller do
context 'when tag exists' do
it 'returns http success' do
get :show, params: { id: 'test', max_id: late.id }
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
end
it 'renders application layout' do
@@ -25,7 +25,7 @@ RSpec.describe TagsController, type: :controller do
it 'returns http missing for non-existent tag' do
get :show, params: { id: 'none' }
expect(response).to have_http_status(:missing)
expect(response).to have_http_status(404)
end
end
end
@@ -7,10 +7,10 @@ describe WellKnown::HostMetaController, type: :controller do
it 'returns http success' do
get :show, format: :xml
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.content_type).to eq 'application/xrd+xml'
expect(response.body).to eq <<XML
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
<Link rel="lrdd" type="application/xrd+xml" template="https://cb6e6126.ngrok.io/.well-known/webfinger?resource={uri}"/>
</XRD>
@@ -50,7 +50,7 @@ PEM
json = body_as_json
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.content_type).to eq 'application/jrd+json'
expect(json[:subject]).to eq 'acct:alice@cb6e6126.ngrok.io'
expect(json[:aliases]).to include('https://cb6e6126.ngrok.io/@alice', 'https://cb6e6126.ngrok.io/users/alice')
@@ -61,7 +61,7 @@ PEM
xml = Nokogiri::XML(response.body)
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.content_type).to eq 'application/xrd+xml'
expect(xml.at_xpath('//xmlns:Subject').content).to eq 'acct:alice@cb6e6126.ngrok.io'
expect(xml.xpath('//xmlns:Alias').map(&:content)).to include('https://cb6e6126.ngrok.io/@alice', 'https://cb6e6126.ngrok.io/users/alice')
@@ -81,7 +81,7 @@ PEM
json = body_as_json
expect(response).to have_http_status(:success)
expect(response).to have_http_status(200)
expect(response.content_type).to eq 'application/jrd+json'
expect(json[:subject]).to eq 'acct:alice@cb6e6126.ngrok.io'
expect(json[:aliases]).to include('https://cb6e6126.ngrok.io/@alice', 'https://cb6e6126.ngrok.io/users/alice')
+7 -1
View File
@@ -1,4 +1,10 @@
keypair = OpenSSL::PKey::RSA.new(2048)
public_key = keypair.public_key.to_pem
private_key = keypair.to_pem
Fabricator(:account) do
username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } }
username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } }
last_webfingered_at { Time.now.utc }
public_key { public_key }
private_key { private_key}
end
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/activity+json; charset=utf-8
Link: <https://ap.example.com/.well-known/webfinger?resource=acct%3Afoo%40ap.example.com>; rel="lrdd"; type="application/xrd+xml", <https://ap.example.com/users/foo.atom>; rel="alternate"; type="application/atom+xml", <https://ap.example.com/users/foo>; rel="alternate"; type="application/activity+json"
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"vcard": "http://www.w3.org/2006/vcard/ns#"},{"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","Hashtag":"as:Hashtag","ostatus":"http://ostatus.org#","atomUri":"ostatus:atomUri","inReplyToAtomUri":"ostatus:inReplyToAtomUri","conversation":"ostatus:conversation"}],"id":"https://ap.example.com/users/foo","type":["Person","vcard:individual"],"following":"https://ap.example.com/users/foo/following","followers":"https://ap.example.com/users/foo/followers","inbox":"https://ap.example.com/users/foo/inbox","outbox":"https://ap.example.com/users/foo/outbox","preferredUsername":"foo","vcard:fn":"foo","name":"","summary":"\u003cp\u003etest\u003c/p\u003e","url":"https://ap.example.com/@foo","manuallyApprovesFollowers":false,"publicKey":{"id":"https://ap.example.com/users/foo#main-key","owner":"https://ap.example.com/users/foo","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu3L4vnpNLzVH31MeWI39\n4F0wKeJFsLDAsNXGeOu0QF2x+h1zLWZw/agqD2R3JPU9/kaDJGPIV2Sn5zLyUA9S\n6swCCMOtn7BBR9g9sucgXJmUFB0tACH2QSgHywMAybGfmSb3LsEMNKsGJ9VsvYoh\n8lDET6X4Pyw+ZJU0/OLo/41q9w+OrGtlsTm/PuPIeXnxa6BLqnDaxC+4IcjG/FiP\nahNCTINl/1F/TgSSDZ4Taf4U9XFEIFw8wmgploELozzIzKq+t8nhQYkgAkt64euW\npva3qL5KD1mTIZQEP+LZvh3s2WHrLi3fhbdRuwQ2c0KkJA2oSTFPDpqqbPGZ3Qvu\nHQIDAQAB\n-----END PUBLIC KEY-----\n"},"endpoints":{"sharedInbox":"https://ap.example.com/inbox"},"icon":{"type":"Image","url":"https://quitter.no/avatar/7477-300-20160211190340.png"}}
+391
View File
@@ -0,0 +1,391 @@
HTTP/1.1 200 OK
Date: Tue, 01 May 2018 23:25:57 GMT
Content-Location: activitystreams.jsonld
Vary: negotiate,accept
TCN: choice
Last-Modified: Mon, 16 Apr 2018 00:28:23 GMT
ETag: "1eb0-569ec4caa97c0;d3-540ee27e0eec0"
Accept-Ranges: bytes
Content-Length: 7856
Cache-Control: max-age=21600
Expires: Wed, 02 May 2018 05:25:57 GMT
P3P: policyref="http://www.w3.org/2014/08/p3p.xml"
Access-Control-Allow-Origin: *
Content-Type: application/ld+json
Strict-Transport-Security: max-age=15552000; includeSubdomains; preload
Content-Security-Policy: upgrade-insecure-requests
{
"@context": {
"@vocab": "_:",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"as": "https://www.w3.org/ns/activitystreams#",
"ldp": "http://www.w3.org/ns/ldp#",
"id": "@id",
"type": "@type",
"Accept": "as:Accept",
"Activity": "as:Activity",
"IntransitiveActivity": "as:IntransitiveActivity",
"Add": "as:Add",
"Announce": "as:Announce",
"Application": "as:Application",
"Arrive": "as:Arrive",
"Article": "as:Article",
"Audio": "as:Audio",
"Block": "as:Block",
"Collection": "as:Collection",
"CollectionPage": "as:CollectionPage",
"Relationship": "as:Relationship",
"Create": "as:Create",
"Delete": "as:Delete",
"Dislike": "as:Dislike",
"Document": "as:Document",
"Event": "as:Event",
"Follow": "as:Follow",
"Flag": "as:Flag",
"Group": "as:Group",
"Ignore": "as:Ignore",
"Image": "as:Image",
"Invite": "as:Invite",
"Join": "as:Join",
"Leave": "as:Leave",
"Like": "as:Like",
"Link": "as:Link",
"Mention": "as:Mention",
"Note": "as:Note",
"Object": "as:Object",
"Offer": "as:Offer",
"OrderedCollection": "as:OrderedCollection",
"OrderedCollectionPage": "as:OrderedCollectionPage",
"Organization": "as:Organization",
"Page": "as:Page",
"Person": "as:Person",
"Place": "as:Place",
"Profile": "as:Profile",
"Question": "as:Question",
"Reject": "as:Reject",
"Remove": "as:Remove",
"Service": "as:Service",
"TentativeAccept": "as:TentativeAccept",
"TentativeReject": "as:TentativeReject",
"Tombstone": "as:Tombstone",
"Undo": "as:Undo",
"Update": "as:Update",
"Video": "as:Video",
"View": "as:View",
"Listen": "as:Listen",
"Read": "as:Read",
"Move": "as:Move",
"Travel": "as:Travel",
"IsFollowing": "as:IsFollowing",
"IsFollowedBy": "as:IsFollowedBy",
"IsContact": "as:IsContact",
"IsMember": "as:IsMember",
"subject": {
"@id": "as:subject",
"@type": "@id"
},
"relationship": {
"@id": "as:relationship",
"@type": "@id"
},
"actor": {
"@id": "as:actor",
"@type": "@id"
},
"attributedTo": {
"@id": "as:attributedTo",
"@type": "@id"
},
"attachment": {
"@id": "as:attachment",
"@type": "@id"
},
"bcc": {
"@id": "as:bcc",
"@type": "@id"
},
"bto": {
"@id": "as:bto",
"@type": "@id"
},
"cc": {
"@id": "as:cc",
"@type": "@id"
},
"context": {
"@id": "as:context",
"@type": "@id"
},
"current": {
"@id": "as:current",
"@type": "@id"
},
"first": {
"@id": "as:first",
"@type": "@id"
},
"generator": {
"@id": "as:generator",
"@type": "@id"
},
"icon": {
"@id": "as:icon",
"@type": "@id"
},
"image": {
"@id": "as:image",
"@type": "@id"
},
"inReplyTo": {
"@id": "as:inReplyTo",
"@type": "@id"
},
"items": {
"@id": "as:items",
"@type": "@id"
},
"instrument": {
"@id": "as:instrument",
"@type": "@id"
},
"orderedItems": {
"@id": "as:items",
"@type": "@id",
"@container": "@list"
},
"last": {
"@id": "as:last",
"@type": "@id"
},
"location": {
"@id": "as:location",
"@type": "@id"
},
"next": {
"@id": "as:next",
"@type": "@id"
},
"object": {
"@id": "as:object",
"@type": "@id"
},
"oneOf": {
"@id": "as:oneOf",
"@type": "@id"
},
"anyOf": {
"@id": "as:anyOf",
"@type": "@id"
},
"closed": {
"@id": "as:closed",
"@type": "xsd:dateTime"
},
"origin": {
"@id": "as:origin",
"@type": "@id"
},
"accuracy": {
"@id": "as:accuracy",
"@type": "xsd:float"
},
"prev": {
"@id": "as:prev",
"@type": "@id"
},
"preview": {
"@id": "as:preview",
"@type": "@id"
},
"replies": {
"@id": "as:replies",
"@type": "@id"
},
"result": {
"@id": "as:result",
"@type": "@id"
},
"audience": {
"@id": "as:audience",
"@type": "@id"
},
"partOf": {
"@id": "as:partOf",
"@type": "@id"
},
"tag": {
"@id": "as:tag",
"@type": "@id"
},
"target": {
"@id": "as:target",
"@type": "@id"
},
"to": {
"@id": "as:to",
"@type": "@id"
},
"url": {
"@id": "as:url",
"@type": "@id"
},
"altitude": {
"@id": "as:altitude",
"@type": "xsd:float"
},
"content": "as:content",
"contentMap": {
"@id": "as:content",
"@container": "@language"
},
"name": "as:name",
"nameMap": {
"@id": "as:name",
"@container": "@language"
},
"duration": {
"@id": "as:duration",
"@type": "xsd:duration"
},
"endTime": {
"@id": "as:endTime",
"@type": "xsd:dateTime"
},
"height": {
"@id": "as:height",
"@type": "xsd:nonNegativeInteger"
},
"href": {
"@id": "as:href",
"@type": "@id"
},
"hreflang": "as:hreflang",
"latitude": {
"@id": "as:latitude",
"@type": "xsd:float"
},
"longitude": {
"@id": "as:longitude",
"@type": "xsd:float"
},
"mediaType": "as:mediaType",
"published": {
"@id": "as:published",
"@type": "xsd:dateTime"
},
"radius": {
"@id": "as:radius",
"@type": "xsd:float"
},
"rel": "as:rel",
"startIndex": {
"@id": "as:startIndex",
"@type": "xsd:nonNegativeInteger"
},
"startTime": {
"@id": "as:startTime",
"@type": "xsd:dateTime"
},
"summary": "as:summary",
"summaryMap": {
"@id": "as:summary",
"@container": "@language"
},
"totalItems": {
"@id": "as:totalItems",
"@type": "xsd:nonNegativeInteger"
},
"units": "as:units",
"updated": {
"@id": "as:updated",
"@type": "xsd:dateTime"
},
"width": {
"@id": "as:width",
"@type": "xsd:nonNegativeInteger"
},
"describes": {
"@id": "as:describes",
"@type": "@id"
},
"formerType": {
"@id": "as:formerType",
"@type": "@id"
},
"deleted": {
"@id": "as:deleted",
"@type": "xsd:dateTime"
},
"inbox": {
"@id": "ldp:inbox",
"@type": "@id"
},
"outbox": {
"@id": "as:outbox",
"@type": "@id"
},
"following": {
"@id": "as:following",
"@type": "@id"
},
"followers": {
"@id": "as:followers",
"@type": "@id"
},
"streams": {
"@id": "as:streams",
"@type": "@id"
},
"preferredUsername": "as:preferredUsername",
"endpoints": {
"@id": "as:endpoints",
"@type": "@id"
},
"uploadMedia": {
"@id": "as:uploadMedia",
"@type": "@id"
},
"proxyUrl": {
"@id": "as:proxyUrl",
"@type": "@id"
},
"liked": {
"@id": "as:liked",
"@type": "@id"
},
"oauthAuthorizationEndpoint": {
"@id": "as:oauthAuthorizationEndpoint",
"@type": "@id"
},
"oauthTokenEndpoint": {
"@id": "as:oauthTokenEndpoint",
"@type": "@id"
},
"provideClientKey": {
"@id": "as:provideClientKey",
"@type": "@id"
},
"signClientKey": {
"@id": "as:signClientKey",
"@type": "@id"
},
"sharedInbox": {
"@id": "as:sharedInbox",
"@type": "@id"
},
"Public": {
"@id": "as:Public",
"@type": "@id"
},
"source": "as:source",
"likes": {
"@id": "as:likes",
"@type": "@id"
},
"shares": {
"@id": "as:shares",
"@type": "@id"
}
}
}
+100
View File
@@ -0,0 +1,100 @@
HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept-Encoding
Access-Control-Allow-Origin: *
Content-Type: application/ld+json
Date: Tue, 01 May 2018 23:28:21 GMT
Etag: "e26-547a6fc75b04a-gzip"
Last-Modified: Fri, 03 Feb 2017 21:30:09 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Transfer-Encoding: chunked
{
"@context": {
"id": "@id",
"type": "@type",
"cred": "https://w3id.org/credentials#",
"dc": "http://purl.org/dc/terms/",
"identity": "https://w3id.org/identity#",
"perm": "https://w3id.org/permissions#",
"ps": "https://w3id.org/payswarm#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"sec": "https://w3id.org/security#",
"schema": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"Group": "https://www.w3.org/ns/activitystreams#Group",
"claim": {"@id": "cred:claim", "@type": "@id"},
"credential": {"@id": "cred:credential", "@type": "@id"},
"issued": {"@id": "cred:issued", "@type": "xsd:dateTime"},
"issuer": {"@id": "cred:issuer", "@type": "@id"},
"recipient": {"@id": "cred:recipient", "@type": "@id"},
"Credential": "cred:Credential",
"CryptographicKeyCredential": "cred:CryptographicKeyCredential",
"about": {"@id": "schema:about", "@type": "@id"},
"address": {"@id": "schema:address", "@type": "@id"},
"addressCountry": "schema:addressCountry",
"addressLocality": "schema:addressLocality",
"addressRegion": "schema:addressRegion",
"comment": "rdfs:comment",
"created": {"@id": "dc:created", "@type": "xsd:dateTime"},
"creator": {"@id": "dc:creator", "@type": "@id"},
"description": "schema:description",
"email": "schema:email",
"familyName": "schema:familyName",
"givenName": "schema:givenName",
"image": {"@id": "schema:image", "@type": "@id"},
"label": "rdfs:label",
"name": "schema:name",
"postalCode": "schema:postalCode",
"streetAddress": "schema:streetAddress",
"title": "dc:title",
"url": {"@id": "schema:url", "@type": "@id"},
"Person": "schema:Person",
"PostalAddress": "schema:PostalAddress",
"Organization": "schema:Organization",
"identityService": {"@id": "identity:identityService", "@type": "@id"},
"idp": {"@id": "identity:idp", "@type": "@id"},
"Identity": "identity:Identity",
"paymentProcessor": "ps:processor",
"preferences": {"@id": "ps:preferences", "@type": "@vocab"},
"cipherAlgorithm": "sec:cipherAlgorithm",
"cipherData": "sec:cipherData",
"cipherKey": "sec:cipherKey",
"digestAlgorithm": "sec:digestAlgorithm",
"digestValue": "sec:digestValue",
"domain": "sec:domain",
"expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
"initializationVector": "sec:initializationVector",
"member": {"@id": "schema:member", "@type": "@id"},
"memberOf": {"@id": "schema:memberOf", "@type": "@id"},
"nonce": "sec:nonce",
"normalizationAlgorithm": "sec:normalizationAlgorithm",
"owner": {"@id": "sec:owner", "@type": "@id"},
"password": "sec:password",
"privateKey": {"@id": "sec:privateKey", "@type": "@id"},
"privateKeyPem": "sec:privateKeyPem",
"publicKey": {"@id": "sec:publicKey", "@type": "@id"},
"publicKeyPem": "sec:publicKeyPem",
"publicKeyService": {"@id": "sec:publicKeyService", "@type": "@id"},
"revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"},
"signature": "sec:signature",
"signatureAlgorithm": "sec:signatureAlgorithm",
"signatureValue": "sec:signatureValue",
"CryptographicKey": "sec:Key",
"EncryptedMessage": "sec:EncryptedMessage",
"GraphSignature2012": "sec:GraphSignature2012",
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
"accessControl": {"@id": "perm:accessControl", "@type": "@id"},
"writePermission": {"@id": "perm:writePermission", "@type": "@id"}
}
}
+61
View File
@@ -0,0 +1,61 @@
HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept-Encoding
Access-Control-Allow-Origin: *
Content-Type: application/ld+json
Date: Wed, 02 May 2018 16:25:32 GMT
Etag: "7e3-5651ec0f7c5ed-gzip"
Last-Modified: Tue, 13 Feb 2018 21:34:04 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 2019
{
"@context": {
"id": "@id",
"type": "@type",
"dc": "http://purl.org/dc/terms/",
"sec": "https://w3id.org/security#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"EcdsaKoblitzSignature2016": "sec:EcdsaKoblitzSignature2016",
"Ed25519Signature2018": "sec:Ed25519Signature2018",
"EncryptedMessage": "sec:EncryptedMessage",
"GraphSignature2012": "sec:GraphSignature2012",
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
"LinkedDataSignature2016": "sec:LinkedDataSignature2016",
"CryptographicKey": "sec:Key",
"authenticationTag": "sec:authenticationTag",
"canonicalizationAlgorithm": "sec:canonicalizationAlgorithm",
"cipherAlgorithm": "sec:cipherAlgorithm",
"cipherData": "sec:cipherData",
"cipherKey": "sec:cipherKey",
"created": {"@id": "dc:created", "@type": "xsd:dateTime"},
"creator": {"@id": "dc:creator", "@type": "@id"},
"digestAlgorithm": "sec:digestAlgorithm",
"digestValue": "sec:digestValue",
"domain": "sec:domain",
"encryptionKey": "sec:encryptionKey",
"expiration": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
"expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
"initializationVector": "sec:initializationVector",
"iterationCount": "sec:iterationCount",
"nonce": "sec:nonce",
"normalizationAlgorithm": "sec:normalizationAlgorithm",
"owner": {"@id": "sec:owner", "@type": "@id"},
"password": "sec:password",
"privateKey": {"@id": "sec:privateKey", "@type": "@id"},
"privateKeyPem": "sec:privateKeyPem",
"publicKey": {"@id": "sec:publicKey", "@type": "@id"},
"publicKeyBase58": "sec:publicKeyBase58",
"publicKeyPem": "sec:publicKeyPem",
"publicKeyService": {"@id": "sec:publicKeyService", "@type": "@id"},
"revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"},
"salt": "sec:salt",
"signature": "sec:signature",
"signatureAlgorithm": "sec:signingAlgorithm",
"signatureValue": "sec:signatureValue"
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link href='https://host/provider.json' rel='alternate' type='application/json+oembed'>
<link href='https://host.test/provider.json' rel='alternate' type='application/json+oembed'>
</head>
<body></body>
</html>
+2 -2
View File
@@ -7,8 +7,8 @@
> The type attribute must contain either application/json+oembed for JSON
> responses, or text/xml+oembed for XML.
-->
<link href='https://host/provider.json' rel='alternate' type='application/json+oembed'>
<link href='https://host/provider.xml' rel='alternate' type='text/xml+oembed'>
<link href='https://host.test/provider.json' rel='alternate' type='application/json+oembed'>
<link href='https://host.test/provider.xml' rel='alternate' type='text/xml+oembed'>
</head>
<body></body>
</html>
+1 -1
View File
@@ -7,7 +7,7 @@
> The type attribute must contain either application/json+oembed for JSON
> responses, or text/xml+oembed for XML.
-->
<link href='https://host/provider.xml' rel='alternate' type='text/xml+oembed'>
<link href='https://host.test/provider.xml' rel='alternate' type='text/xml+oembed'>
</head>
<body></body>
</html>
+12 -12
View File
@@ -32,37 +32,37 @@ describe JsonLdHelper do
describe '#fetch_resource' do
context 'when the second argument is false' do
it 'returns resource even if the retrieved ID and the given URI does not match' do
stub_request(:get, 'https://bob/').to_return body: '{"id": "https://alice/"}'
stub_request(:get, 'https://alice/').to_return body: '{"id": "https://alice/"}'
stub_request(:get, 'https://bob.test/').to_return body: '{"id": "https://alice.test/"}'
stub_request(:get, 'https://alice.test/').to_return body: '{"id": "https://alice.test/"}'
expect(fetch_resource('https://bob/', false)).to eq({ 'id' => 'https://alice/' })
expect(fetch_resource('https://bob.test/', false)).to eq({ 'id' => 'https://alice.test/' })
end
it 'returns nil if the object identified by the given URI and the object identified by the retrieved ID does not match' do
stub_request(:get, 'https://mallory/').to_return body: '{"id": "https://marvin/"}'
stub_request(:get, 'https://marvin/').to_return body: '{"id": "https://alice/"}'
stub_request(:get, 'https://mallory.test/').to_return body: '{"id": "https://marvin.test/"}'
stub_request(:get, 'https://marvin.test/').to_return body: '{"id": "https://alice.test/"}'
expect(fetch_resource('https://mallory/', false)).to eq nil
expect(fetch_resource('https://mallory.test/', false)).to eq nil
end
end
context 'when the second argument is true' do
it 'returns nil if the retrieved ID and the given URI does not match' do
stub_request(:get, 'https://mallory/').to_return body: '{"id": "https://alice/"}'
expect(fetch_resource('https://mallory/', true)).to eq nil
stub_request(:get, 'https://mallory.test/').to_return body: '{"id": "https://alice.test/"}'
expect(fetch_resource('https://mallory.test/', true)).to eq nil
end
end
end
describe '#fetch_resource_without_id_validation' do
it 'returns nil if the status code is not 200' do
stub_request(:get, 'https://host/').to_return status: 400, body: '{}'
expect(fetch_resource_without_id_validation('https://host/')).to eq nil
stub_request(:get, 'https://host.test/').to_return status: 400, body: '{}'
expect(fetch_resource_without_id_validation('https://host.test/')).to eq nil
end
it 'returns hash' do
stub_request(:get, 'https://host/').to_return status: 200, body: '{}'
expect(fetch_resource_without_id_validation('https://host/')).to eq({})
stub_request(:get, 'https://host.test/').to_return status: 200, body: '{}'
expect(fetch_resource_without_id_validation('https://host.test/')).to eq({})
end
end
end
@@ -16,6 +16,10 @@ RSpec.describe ActivityPub::LinkedDataSignature do
subject { described_class.new(json) }
before do
stub_jsonld_contexts!
end
describe '#verify_account!' do
context 'when signature matches' do
let(:raw_signature) do
+3 -3
View File
@@ -2,7 +2,7 @@ require 'rails_helper'
RSpec.describe Formatter do
let(:local_account) { Fabricate(:account, domain: nil, username: 'alice') }
let(:remote_account) { Fabricate(:account, domain: 'remote', username: 'bob', url: 'https://remote/') }
let(:remote_account) { Fabricate(:account, domain: 'remote.test', username: 'bob', url: 'https://remote.test/') }
shared_examples 'encode and link URLs' do
context 'matches a stand-alone medium URL' do
@@ -377,12 +377,12 @@ RSpec.describe Formatter do
end
context 'contains linkable mentions for remote accounts' do
let(:text) { '@bob@remote' }
let(:text) { '@bob@remote.test' }
before { remote_account }
it 'links' do
is_expected.to eq '<p><span class="h-card"><a href="https://remote/" class="u-url mention">@<span>bob</span></a></span></p>'
is_expected.to eq '<p><span class="h-card"><a href="https://remote.test/" class="u-url mention">@<span>bob</span></a></span></p>'
end
end
+13 -19
View File
@@ -30,13 +30,13 @@ RSpec.describe OStatus::AtomSerializer do
end
it 'appends activity:object with target account' do
target_account = Fabricate(:account, domain: 'domain', uri: 'https://domain/id')
target_account = Fabricate(:account, domain: 'domain.test', uri: 'https://domain.test/id')
follow_request = Fabricate(:follow_request, target_account: target_account)
follow_request_salmon = serialize(follow_request)
object = follow_request_salmon.nodes.find { |node| node.name == 'activity:object' }
expect(object.id.text).to eq 'https://domain/id'
expect(object.id.text).to eq 'https://domain.test/id'
end
end
@@ -386,12 +386,6 @@ RSpec.describe OStatus::AtomSerializer do
expect(entry.category[:term]).to eq 'tag'
end
it 'appends category element for NSFW if status is sensitive' do
status = Fabricate(:status, sensitive: true)
entry = OStatus::AtomSerializer.new.entry(status.stream_entry)
expect(entry.category[:term]).to eq 'nsfw'
end
it 'appends link elements for media attachments' do
file = attachment_fixture('attachment.jpg')
media_attachment = Fabricate(:media_attachment, file: file)
@@ -419,20 +413,20 @@ RSpec.describe OStatus::AtomSerializer do
entry = OStatus::AtomSerializer.new.entry(remote_status.stream_entry, true)
entry.nodes.delete_if { |node| node[:type] == 'application/activity+json' } # Remove ActivityPub link to simplify test
xml = OStatus::AtomSerializer.render(entry).gsub('cb6e6126.ngrok.io', 'remote')
xml = OStatus::AtomSerializer.render(entry).gsub('cb6e6126.ngrok.io', 'remote.test')
remote_status.destroy!
remote_account.destroy!
account = Account.create!(
domain: 'remote',
domain: 'remote.test',
username: 'username',
last_webfingered_at: Time.now.utc
)
ProcessFeedService.new.call(xml, account)
expect(Status.find_by(uri: "https://remote/users/#{remote_status.account.to_param}/statuses/#{remote_status.id}")).to be_instance_of Status
expect(Status.find_by(uri: "https://remote.test/users/#{remote_status.account.to_param}/statuses/#{remote_status.id}")).to be_instance_of Status
end
end
@@ -782,13 +776,13 @@ RSpec.describe OStatus::AtomSerializer do
end
it 'appends activity:object element with target account' do
target_account = Fabricate(:account, domain: 'domain', uri: 'https://domain/id')
target_account = Fabricate(:account, domain: 'domain.test', uri: 'https://domain.test/id')
block = Fabricate(:block, target_account: target_account)
block_salmon = OStatus::AtomSerializer.new.block_salmon(block)
object = block_salmon.nodes.find { |node| node.name == 'activity:object' }
expect(object.id.text).to eq 'https://domain/id'
expect(object.id.text).to eq 'https://domain.test/id'
end
it 'returns element whose rendered view triggers block when processed' do
@@ -869,13 +863,13 @@ RSpec.describe OStatus::AtomSerializer do
end
it 'appends activity:object element with target account' do
target_account = Fabricate(:account, domain: 'domain', uri: 'https://domain/id')
target_account = Fabricate(:account, domain: 'domain.test', uri: 'https://domain.test/id')
block = Fabricate(:block, target_account: target_account)
unblock_salmon = OStatus::AtomSerializer.new.unblock_salmon(block)
object = unblock_salmon.nodes.find { |node| node.name == 'activity:object' }
expect(object.id.text).to eq 'https://domain/id'
expect(object.id.text).to eq 'https://domain.test/id'
end
it 'returns element whose rendered view triggers block when processed' do
@@ -1130,13 +1124,13 @@ RSpec.describe OStatus::AtomSerializer do
end
it 'appends activity:object element with target account' do
target_account = Fabricate(:account, domain: 'domain', uri: 'https://domain/id')
target_account = Fabricate(:account, domain: 'domain.test', uri: 'https://domain.test/id')
follow = Fabricate(:follow, target_account: target_account)
follow_salmon = OStatus::AtomSerializer.new.follow_salmon(follow)
object = follow_salmon.nodes.find { |node| node.name == 'activity:object' }
expect(object.id.text).to eq 'https://domain/id'
expect(object.id.text).to eq 'https://domain.test/id'
end
it 'includes description' do
@@ -1248,14 +1242,14 @@ RSpec.describe OStatus::AtomSerializer do
end
it 'appends activity:object element with target account' do
target_account = Fabricate(:account, domain: 'domain', uri: 'https://domain/id')
target_account = Fabricate(:account, domain: 'domain.test', uri: 'https://domain.test/id')
follow = Fabricate(:follow, target_account: target_account)
follow.destroy!
unfollow_salmon = OStatus::AtomSerializer.new.unfollow_salmon(follow)
object = unfollow_salmon.nodes.find { |node| node.name == 'activity:object' }
expect(object.id.text).to eq 'https://domain/id'
expect(object.id.text).to eq 'https://domain.test/id'
end
it 'returns element whose rendered view triggers unfollow when processed' do
+17 -17
View File
@@ -6,7 +6,7 @@ RSpec.describe TagManager do
around do |example|
original_local_domain = Rails.configuration.x.local_domain
Rails.configuration.x.local_domain = 'domain'
Rails.configuration.x.local_domain = 'domain.test'
example.run
@@ -18,11 +18,11 @@ RSpec.describe TagManager do
end
it 'returns true if the slash-stripped string equals to local domain' do
expect(TagManager.instance.local_domain?('DoMaIn/')).to eq true
expect(TagManager.instance.local_domain?('DoMaIn.Test/')).to eq true
end
it 'returns false for irrelevant string' do
expect(TagManager.instance.local_domain?('DoMaIn!')).to eq false
expect(TagManager.instance.local_domain?('DoMaIn.Test!')).to eq false
end
end
@@ -31,7 +31,7 @@ RSpec.describe TagManager do
around do |example|
original_web_domain = Rails.configuration.x.web_domain
Rails.configuration.x.web_domain = 'domain'
Rails.configuration.x.web_domain = 'domain.test'
example.run
@@ -43,11 +43,11 @@ RSpec.describe TagManager do
end
it 'returns true if the slash-stripped string equals to web domain' do
expect(TagManager.instance.web_domain?('DoMaIn/')).to eq true
expect(TagManager.instance.web_domain?('DoMaIn.Test/')).to eq true
end
it 'returns false for string with irrelevant characters' do
expect(TagManager.instance.web_domain?('DoMaIn!')).to eq false
expect(TagManager.instance.web_domain?('DoMaIn.Test!')).to eq false
end
end
@@ -57,7 +57,7 @@ RSpec.describe TagManager do
end
it 'returns normalized domain' do
expect(TagManager.instance.normalize_domain('DoMaIn/')).to eq 'domain'
expect(TagManager.instance.normalize_domain('DoMaIn.Test/')).to eq 'domain.test'
end
end
@@ -69,18 +69,18 @@ RSpec.describe TagManager do
end
it 'returns true if the normalized string with port is local URL' do
Rails.configuration.x.web_domain = 'domain:42'
expect(TagManager.instance.local_url?('https://DoMaIn:42/')).to eq true
Rails.configuration.x.web_domain = 'domain.test:42'
expect(TagManager.instance.local_url?('https://DoMaIn.Test:42/')).to eq true
end
it 'returns true if the normalized string without port is local URL' do
Rails.configuration.x.web_domain = 'domain'
expect(TagManager.instance.local_url?('https://DoMaIn/')).to eq true
Rails.configuration.x.web_domain = 'domain.test'
expect(TagManager.instance.local_url?('https://DoMaIn.Test/')).to eq true
end
it 'returns false for string with irrelevant characters' do
Rails.configuration.x.web_domain = 'domain'
expect(TagManager.instance.local_url?('https://domainn/')).to eq false
Rails.configuration.x.web_domain = 'domain.test'
expect(TagManager.instance.local_url?('https://domainn.test/')).to eq false
end
end
@@ -88,19 +88,19 @@ RSpec.describe TagManager do
# The following comparisons MUST be case-insensitive.
it 'returns true if the needle has a correct username and domain for remote user' do
expect(TagManager.instance.same_acct?('username@domain', 'UsErNaMe@DoMaIn')).to eq true
expect(TagManager.instance.same_acct?('username@domain.test', 'UsErNaMe@DoMaIn.Test')).to eq true
end
it 'returns false if the needle is missing a domain for remote user' do
expect(TagManager.instance.same_acct?('username@domain', 'UsErNaMe')).to eq false
expect(TagManager.instance.same_acct?('username@domain.test', 'UsErNaMe')).to eq false
end
it 'returns false if the needle has an incorrect domain for remote user' do
expect(TagManager.instance.same_acct?('username@domain', 'UsErNaMe@incorrect')).to eq false
expect(TagManager.instance.same_acct?('username@domain.test', 'UsErNaMe@incorrect.test')).to eq false
end
it 'returns false if the needle has an incorrect username for remote user' do
expect(TagManager.instance.same_acct?('username@domain', 'incorrect@DoMaIn')).to eq false
expect(TagManager.instance.same_acct?('username@domain.test', 'incorrect@DoMaIn.test')).to eq false
end
it 'returns true if the needle has a correct username and domain for local user' do
+7 -6
View File
@@ -94,14 +94,14 @@ RSpec.describe Account, type: :model do
describe '#save_with_optional_media!' do
before do
stub_request(:get, 'https://remote/valid_avatar').to_return(request_fixture('avatar.txt'))
stub_request(:get, 'https://remote/invalid_avatar').to_return(request_fixture('feed.txt'))
stub_request(:get, 'https://remote.test/valid_avatar').to_return(request_fixture('avatar.txt'))
stub_request(:get, 'https://remote.test/invalid_avatar').to_return(request_fixture('feed.txt'))
end
let(:account) do
Fabricate(:account,
avatar_remote_url: 'https://remote/valid_avatar',
header_remote_url: 'https://remote/valid_avatar')
avatar_remote_url: 'https://remote.test/valid_avatar',
header_remote_url: 'https://remote.test/valid_avatar')
end
let!(:expectation) { account.dup }
@@ -121,7 +121,7 @@ RSpec.describe Account, type: :model do
context 'with invalid properties' do
before do
account.avatar_remote_url = 'https://remote/invalid_avatar'
account.avatar_remote_url = 'https://remote.test/invalid_avatar'
account.save_with_optional_media!
end
@@ -815,7 +815,8 @@ RSpec.describe Account, type: :model do
end
context 'when is local' do
it 'generates keys' do
# Test disabled because test environment omits autogenerating keys for performance
xit 'generates keys' do
account = Account.create!(domain: nil, username: Faker::Internet.user_name(nil, ['_']))
expect(account.keypair.private?).to eq true
end

Some files were not shown because too many files have changed in this diff Show More