Merge remote-tracking branch 'parent/main' into upstream-20240906
This commit is contained in:
commit
f18eabfe75
689 changed files with 4369 additions and 2434 deletions
|
@ -42,9 +42,11 @@ RSpec.describe 'API V2 Filters Keywords' do
|
|||
it 'creates a filter', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
json = body_as_json
|
||||
expect(json[:keyword]).to eq 'magic'
|
||||
expect(json[:whole_word]).to be false
|
||||
expect(body_as_json)
|
||||
.to include(
|
||||
keyword: 'magic',
|
||||
whole_word: false
|
||||
)
|
||||
|
||||
filter = user.account.custom_filters.first
|
||||
expect(filter).to_not be_nil
|
||||
|
@ -71,9 +73,11 @@ RSpec.describe 'API V2 Filters Keywords' do
|
|||
it 'responds with the keyword', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
json = body_as_json
|
||||
expect(json[:keyword]).to eq 'foo'
|
||||
expect(json[:whole_word]).to be false
|
||||
expect(body_as_json)
|
||||
.to include(
|
||||
keyword: 'foo',
|
||||
whole_word: false
|
||||
)
|
||||
end
|
||||
|
||||
context "when trying to access another user's filter keyword" do
|
||||
|
|
|
@ -43,8 +43,10 @@ RSpec.describe 'API V2 Filters Statuses' do
|
|||
it 'creates a filter', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
json = body_as_json
|
||||
expect(json[:status_id]).to eq status.id.to_s
|
||||
expect(body_as_json)
|
||||
.to include(
|
||||
status_id: status.id.to_s
|
||||
)
|
||||
|
||||
filter = user.account.custom_filters.first
|
||||
expect(filter).to_not be_nil
|
||||
|
@ -71,8 +73,10 @@ RSpec.describe 'API V2 Filters Statuses' do
|
|||
it 'responds with the filter', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
json = body_as_json
|
||||
expect(json[:status_id]).to eq status_filter.status_id.to_s
|
||||
expect(body_as_json)
|
||||
.to include(
|
||||
status_id: status_filter.status.id.to_s
|
||||
)
|
||||
end
|
||||
|
||||
context "when trying to access another user's filter keyword" do
|
||||
|
|
|
@ -68,15 +68,18 @@ RSpec.describe 'Filters' do
|
|||
it 'returns a filter with keywords', :aggregate_failures do
|
||||
subject
|
||||
|
||||
json = body_as_json
|
||||
|
||||
expect(json[:title]).to eq 'magic'
|
||||
expect(json[:filter_action]).to eq 'hide'
|
||||
expect(json[:context]).to eq ['home']
|
||||
expect(json[:keywords].map { |keyword| keyword.slice(:keyword, :whole_word) }).to eq [{ keyword: 'magic', whole_word: true }]
|
||||
expect(json[:exclude_follows]).to be true
|
||||
expect(json[:exclude_localusers]).to be true
|
||||
expect(json[:with_profile]).to be true
|
||||
expect(body_as_json)
|
||||
.to include(
|
||||
title: 'magic',
|
||||
filter_action: 'hide',
|
||||
context: %w(home),
|
||||
keywords: contain_exactly(
|
||||
include(keyword: 'magic', whole_word: true)
|
||||
),
|
||||
exclude_follows: true,
|
||||
exclude_localusers: true,
|
||||
with_profile: true
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates a filter', :aggregate_failures do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Instances' do
|
||||
RSpec.describe 'Instances' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
|
||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Search API' do
|
||||
RSpec.describe 'Search API' do
|
||||
context 'with token' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Suggestions API' do
|
||||
RSpec.describe 'Suggestions API' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:scopes) { 'read' }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue