DEV: Document the user suspend api endpoint (#12179)

Wrote an api docs rspec test for documenting the user suspend api
endpoint.
This commit is contained in:
Blake Erickson
2021-02-23 05:58:22 -07:00
committed by GitHub
parent 73fa4263fb
commit 0b2b4bc245
3 changed files with 86 additions and 0 deletions

View File

@ -308,6 +308,35 @@ describe 'users' do
end
path '/admin/users/{id}/suspend.json' do
put 'Suspend a user' do
tags 'Users', 'Admin'
consumes 'application/json'
expected_request_schema = load_spec_schema('user_suspend_request')
parameter name: :id, in: :path, type: :integer, required: true
parameter name: :params, in: :body, schema: expected_request_schema
produces 'application/json'
response '200', 'response' do
let(:id) { Fabricate(:user).id }
let(:params) { {
'suspend_until' => '2121-02-22',
'reason' => 'inactivity'
} }
expected_response_schema = load_spec_schema('user_suspend_response')
schema(expected_response_schema)
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
let(:expected_request_schema) { expected_request_schema }
end
end
end
end
path '/admin/users/{id}/log_out.json' do
post 'Log a user out' do