mirror of https://github.com/mastodon/mastodon
Add tests for `/api/v1/accounts/:id/*` 404 on deleted accounts
This commit is contained in:
parent
f6d3854828
commit
5956ce9be8
|
@ -56,5 +56,30 @@ describe 'API V1 Accounts FollowerAccounts' do
|
|||
expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when request account is permanently deleted' do
|
||||
before do
|
||||
account.mark_deleted!
|
||||
account.deletion_request.destroy
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when request account is pending deletion' do
|
||||
before do
|
||||
account.mark_deleted!
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,5 +56,30 @@ describe 'API V1 Accounts FollowingAccounts' do
|
|||
expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when request account is permanently deleted' do
|
||||
before do
|
||||
account.mark_deleted!
|
||||
account.deletion_request.destroy
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when request account is pending deletion' do
|
||||
before do
|
||||
account.mark_deleted!
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,4 +22,29 @@ describe 'Accounts Lists API' do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when requested account is permanently deleted' do
|
||||
before do
|
||||
account.mark_deleted!
|
||||
account.deletion_request.destroy
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/lists", headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when requested account is pending deletion' do
|
||||
before do
|
||||
account.mark_deleted!
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/lists", headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -137,6 +137,35 @@ describe 'API V1 Accounts Statuses' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when requested account is permanently deleted' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
account.mark_deleted!
|
||||
account.deletion_request.destroy
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/statuses", params: { limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when requested account is pending deletion' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
account.mark_deleted!
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
get "/api/v1/accounts/#{account.id}/statuses", params: { limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -45,6 +45,31 @@ describe '/api/v1/accounts' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when requesting a permanently deleted account' do
|
||||
let(:other_account) { Fabricate(:account, deleted: true) }
|
||||
|
||||
before do
|
||||
get "/api/v1/accounts/#{other_account.id}"
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when requesting an account pending deletion' do
|
||||
let(:other_account) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
other_account.mark_deleted!
|
||||
get "/api/v1/accounts/#{other_account.id}"
|
||||
end
|
||||
|
||||
it 'returns http not found' do
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when logged in' do
|
||||
subject do
|
||||
get "/api/v1/accounts/#{account.id}", headers: headers
|
||||
|
|
Loading…
Reference in New Issue