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:
Claire 2024-02-24 14:05:26 +01:00
commit 9903e6beab

View File

@ -2,20 +2,17 @@
require 'rails_helper'
describe Api::V1::Timelines::ListController do
render_views
describe 'API V1 Timelines List' do
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) }
before do
allow(controller).to receive(:doorkeeper_token) { token }
end
context 'with a user context' do
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
follow = Fabricate(:follow, account: user.account)
list.accounts << follow.target_account
@ -23,7 +20,8 @@ describe Api::V1::Timelines::ListController do
end
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)
end
end
@ -35,7 +33,8 @@ describe Api::V1::Timelines::ListController do
describe 'GET #show' 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)
end
end
@ -46,7 +45,7 @@ describe Api::V1::Timelines::ListController do
describe 'GET #show' 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.headers['Link']).to be_nil