Skip to content

A platform for community discussion. Free, open, simple.

DEV: Document anonymize user api endpoint (#13893)

Blake Erickson1c60be76586c
diff --git a/spec/requests/api/schemas/json/user_anonymize_response.json b/spec/requests/api/schemas/json/user_anonymize_response.json
new file mode 100644
index 00000000000..45f02680940
--- /dev/null
+++ b/spec/requests/api/schemas/json/user_anonymize_response.json
@@ -0,0 +1,15 @@
+{
+ "additionalProperties": false,
+ "properties": {
+ "success": {
+ "type": "string"
+ },
+ "username": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "success",
+ "username"
+ ]
+}
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 13a7f1842f5..f3a001acdee 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -337,6 +337,30 @@ describe 'users' do
end
end
+ path '/admin/users/{id}/anonymize.json' do
+ put 'Anonymize a user' do
+ tags 'Users', 'Admin'
+ consumes 'application/json'
+ expected_request_schema = nil
+
+ parameter name: :id, in: :path, type: :integer, required: true
+
+ produces 'application/json'
+ response '200', 'response' do
+
+ let(:id) { Fabricate(:user).id }
+
+ expected_response_schema = load_spec_schema('user_anonymize_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