From e69219184b1a3262ec5e617d30337b6431c9840c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Aug 2018 14:58:21 +0200 Subject: Implement user blocking on server side --- server/tests/utils/users/users.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'server/tests/utils/users') diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts index e24e721bd..7e15fc86e 100644 --- a/server/tests/utils/users/users.ts +++ b/server/tests/utils/users/users.ts @@ -134,6 +134,26 @@ function removeUser (url: string, userId: number | string, accessToken: string, .expect(expectedStatus) } +function blockUser (url: string, userId: number | string, accessToken: string, expectedStatus = 204) { + const path = '/api/v1/users' + + return request(url) + .post(path + '/' + userId + '/block') + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + accessToken) + .expect(expectedStatus) +} + +function unblockUser (url: string, userId: number | string, accessToken: string, expectedStatus = 204) { + const path = '/api/v1/users' + + return request(url) + .post(path + '/' + userId + '/unblock') + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + accessToken) + .expect(expectedStatus) +} + function updateMyUser (options: { url: string accessToken: string, @@ -234,6 +254,8 @@ export { updateUser, updateMyUser, getUserInformation, + blockUser, + unblockUser, askResetPassword, resetPassword, updateMyAvatar -- cgit v1.2.3