mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-24 03:43:42 +01:00
Add tests for recently added API end points
This commit is contained in:
parent
3731230c6d
commit
829d189f44
3 changed files with 47 additions and 1 deletions
|
@ -16,7 +16,13 @@ Rails.application.configure do
|
|||
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.cache_store = :redis_store, {
|
||||
host: ENV['REDIS_HOST'] || 'localhost',
|
||||
port: ENV['REDIS_PORT'] || 6379,
|
||||
db: 0,
|
||||
namespace: 'cache'
|
||||
}
|
||||
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => 'public, max-age=172800'
|
||||
}
|
||||
|
|
|
@ -46,6 +46,20 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #suggestions' do
|
||||
it 'returns http success' do
|
||||
get :suggestions
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #common_followers' do
|
||||
it 'returns http success' do
|
||||
get :common_followers, params: { id: user.account.id }
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #follow' do
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
|
||||
|
|
|
@ -33,6 +33,32 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #reblogged_by' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
before do
|
||||
post :reblog, params: { id: status.id }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :reblogged_by, params: { id: status.id }
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #favourited_by' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
before do
|
||||
post :favourite, params: { id: status.id }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :favourited_by, params: { id: status.id }
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #home' do
|
||||
it 'returns http success' do
|
||||
get :home
|
||||
|
|
Loading…
Reference in a new issue