mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 16:44:04 -05:00
Merge commit '0b0ca6f3b85c9d08e4642e49d743f8d060632293' into glitch-soc/merge-upstream
Conflicts: - `spec/controllers/api/v1/timelines/direct_controller_spec.rb`: `spec/controllers/api/v1/timelines` has been renamed, but we had an extra spec here for a glitch-soc-only endpoint. Kept glitch-soc's file unchanged (will port to a request spec later).
This commit is contained in:
commit
9903e6beab
@ -2,20 +2,17 @@
|
|||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Api::V1::Timelines::ListController do
|
describe 'API V1 Timelines List' do
|
||||||
render_views
|
|
||||||
|
|
||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
||||||
|
let(:scopes) { 'read:statuses' }
|
||||||
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||||
|
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||||
let(:list) { Fabricate(:list, account: user.account) }
|
let(:list) { Fabricate(:list, account: user.account) }
|
||||||
|
|
||||||
before do
|
|
||||||
allow(controller).to receive(:doorkeeper_token) { token }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with a user context' do
|
context 'with a user context' do
|
||||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:lists') }
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:lists') }
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET /api/v1/timelines/list/:id' do
|
||||||
before do
|
before do
|
||||||
follow = Fabricate(:follow, account: user.account)
|
follow = Fabricate(:follow, account: user.account)
|
||||||
list.accounts << follow.target_account
|
list.accounts << follow.target_account
|
||||||
@ -23,7 +20,8 @@ describe Api::V1::Timelines::ListController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :show, params: { id: list.id }
|
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||||
|
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -35,7 +33,8 @@ describe Api::V1::Timelines::ListController do
|
|||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
it 'returns http not found' do
|
it 'returns http not found' do
|
||||||
get :show, params: { id: list.id }
|
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||||
|
|
||||||
expect(response).to have_http_status(404)
|
expect(response).to have_http_status(404)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -46,7 +45,7 @@ describe Api::V1::Timelines::ListController do
|
|||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
it 'returns http unprocessable entity' do
|
it 'returns http unprocessable entity' do
|
||||||
get :show, params: { id: list.id }
|
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||||
|
|
||||||
expect(response).to have_http_status(422)
|
expect(response).to have_http_status(422)
|
||||||
expect(response.headers['Link']).to be_nil
|
expect(response.headers['Link']).to be_nil
|
Loading…
Reference in New Issue
Block a user