mirror of
https://github.com/mastodon/mastodon.git
synced 2024-06-01 19:43:29 +00:00
Add tests
This commit is contained in:
parent
e4bf427f65
commit
69253d65c8
|
@ -8,6 +8,22 @@ describe '/api/v1/accounts' do
|
||||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||||
|
|
||||||
|
describe 'GET /api/v1/accounts?ids[]=:id' do
|
||||||
|
let(:account) { Fabricate(:account) }
|
||||||
|
let(:other_account) { Fabricate(:account) }
|
||||||
|
let(:scopes) { 'read:accounts' }
|
||||||
|
|
||||||
|
it 'returns expected response' do
|
||||||
|
get '/api/v1/accounts', headers: headers, params: { ids: [account.id, other_account.id, 123_123] }
|
||||||
|
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
expect(body_as_json.with_indifferent_access).to include(
|
||||||
|
account.id.to_s.to_s => include(id: account.id.to_s),
|
||||||
|
other_account.id.to_s => include(id: other_account.id.to_s)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'GET /api/v1/accounts/:id' do
|
describe 'GET /api/v1/accounts/:id' do
|
||||||
context 'when logged out' do
|
context 'when logged out' do
|
||||||
let(:account) { Fabricate(:account) }
|
let(:account) { Fabricate(:account) }
|
||||||
|
|
|
@ -9,6 +9,22 @@ describe '/api/v1/statuses' do
|
||||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: client_app, scopes: scopes) }
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: client_app, scopes: scopes) }
|
||||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||||
|
|
||||||
|
describe 'GET /api/v1/statuses?ids[]=:id' do
|
||||||
|
let(:status) { Fabricate(:status) }
|
||||||
|
let(:other_status) { Fabricate(:status) }
|
||||||
|
let(:scopes) { 'read:statuses' }
|
||||||
|
|
||||||
|
it 'returns expected response' do
|
||||||
|
get '/api/v1/statuses', headers: headers, params: { ids: [status.id, other_status.id, 123_123] }
|
||||||
|
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
expect(body_as_json.with_indifferent_access).to include(
|
||||||
|
status.id.to_s => include(id: status.id.to_s),
|
||||||
|
other_status.id.to_s => include(id: other_status.id.to_s)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'GET /api/v1/statuses/:id' do
|
describe 'GET /api/v1/statuses/:id' do
|
||||||
subject do
|
subject do
|
||||||
get "/api/v1/statuses/#{status.id}", headers: headers
|
get "/api/v1/statuses/#{status.id}", headers: headers
|
||||||
|
|
Loading…
Reference in a new issue