Merge commit '5dfdec645313e556413147597138a8008bc35996' into glitch-soc/merge-upstream
This commit is contained in:
commit
c2c3a66478
124 files changed
+902
-699
No files matched your search
@@ -20,19 +20,16 @@ RSpec.describe 'Canonical Email Blocks' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no canonical email block' do
|
||||
it 'returns an empty list' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +40,12 @@ RSpec.describe 'Canonical Email Blocks' do
|
||||
it 'returns the correct canonical email hashes' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body.pluck(:canonical_email_hash)).to match_array(expected_email_hashes)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.pluck(:canonical_email_hash))
|
||||
.to match_array(expected_email_hashes)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
|
||||
@@ -20,18 +20,14 @@ RSpec.describe 'Domain Allows' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no allowed domains' do
|
||||
it 'returns an empty body' do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to be_empty
|
||||
end
|
||||
end
|
||||
@@ -51,7 +47,12 @@ RSpec.describe 'Domain Allows' do
|
||||
it 'returns the correct allowed domains' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to match_array(expected_response)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
|
||||
@@ -20,19 +20,16 @@ RSpec.describe 'Domain Blocks' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there are no domain blocks' do
|
||||
it 'returns an empty list' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,7 +63,12 @@ RSpec.describe 'Domain Blocks' do
|
||||
it 'returns the expected domain blocks' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to match_array(expected_responde)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to match_array(expected_responde)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
|
||||
@@ -21,19 +21,16 @@ RSpec.describe 'Email Domain Blocks' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no email domain block' do
|
||||
it 'returns an empty list' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,7 +41,12 @@ RSpec.describe 'Email Domain Blocks' do
|
||||
it 'return the correct blocked email domains' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body.pluck(:domain)).to match_array(blocked_email_domains)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.pluck(:domain))
|
||||
.to match_array(blocked_email_domains)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
|
||||
@@ -20,19 +20,16 @@ RSpec.describe 'IP Blocks' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no ip block' do
|
||||
it 'returns an empty body' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +57,12 @@ RSpec.describe 'IP Blocks' do
|
||||
it 'returns the correct blocked ips' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to match_array(expected_response)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
|
||||
@@ -19,19 +19,16 @@ RSpec.describe 'Reports' do
|
||||
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there are no reports' do
|
||||
it 'returns an empty list' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,7 +63,12 @@ RSpec.describe 'Reports' do
|
||||
it 'returns all unresolved reports' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to match_array(expected_response)
|
||||
end
|
||||
|
||||
context 'with resolved param' do
|
||||
|
||||
@@ -20,19 +20,16 @@ RSpec.describe 'Tags' do
|
||||
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there are no tags' do
|
||||
it 'returns an empty list' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,6 +45,11 @@ RSpec.describe 'Tags' do
|
||||
|
||||
it 'returns the expected tags' do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
tags.each do |tag|
|
||||
expect(response.parsed_body.find { |item| item[:id] == tag.id.to_s && item[:name] == tag.name }).to_not be_nil
|
||||
end
|
||||
@@ -82,8 +84,11 @@ RSpec.describe 'Tags' do
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body[:id].to_i).to eq(tag.id)
|
||||
expect(response.parsed_body[:name]).to eq(tag.name)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
id: tag.id.to_s,
|
||||
name: tag.name
|
||||
)
|
||||
end
|
||||
|
||||
context 'when the requested tag does not exist' do
|
||||
@@ -116,8 +121,11 @@ RSpec.describe 'Tags' do
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body[:id].to_i).to eq(tag.id)
|
||||
expect(response.parsed_body[:name]).to eq(tag.name.upcase)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
id: tag.id.to_s,
|
||||
name: tag.name.upcase
|
||||
)
|
||||
end
|
||||
|
||||
context 'when the updated display name is invalid' do
|
||||
|
||||
@@ -41,8 +41,9 @@ RSpec.describe 'Credentials' do
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body[:client_id]).to_not be_present
|
||||
expect(response.parsed_body[:client_secret]).to_not be_present
|
||||
expect(response.parsed_body)
|
||||
.to not_include(client_id: be_present)
|
||||
.and not_include(client_secret: be_present)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -36,7 +36,10 @@ RSpec.describe 'API V2 Admin Accounts' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(body_json_ids).to eq([admin_account.id])
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
hash_including(id: admin_account.id.to_s)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,8 +50,11 @@ RSpec.describe 'API V2 Admin Accounts' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(body_json_ids).to include(remote_account.id)
|
||||
expect(body_json_ids).to_not include(other_remote_account.id)
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
hash_including(id: remote_account.id.to_s)
|
||||
)
|
||||
.and not_include(hash_including(id: other_remote_account.id.to_s))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,7 +65,11 @@ RSpec.describe 'API V2 Admin Accounts' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(body_json_ids).to include(suspended_remote.id, suspended_account.id)
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
hash_including(id: suspended_remote.id.to_s),
|
||||
hash_including(id: suspended_account.id.to_s)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +80,10 @@ RSpec.describe 'API V2 Admin Accounts' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(body_json_ids).to include(disabled_account.id)
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
hash_including(id: disabled_account.id.to_s)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -81,14 +94,13 @@ RSpec.describe 'API V2 Admin Accounts' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(body_json_ids).to include(pending_account.id)
|
||||
expect(response.parsed_body)
|
||||
.to contain_exactly(
|
||||
hash_including(id: pending_account.id.to_s)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def body_json_ids
|
||||
response.parsed_body.map { |a| a[:id].to_i }
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
let(:params) { { limit: 1 } }
|
||||
|
||||
|
||||
Reference in new issue
Block a user