diff options
Diffstat (limited to 'server/tests/utils/users/users.ts')
-rw-r--r-- | server/tests/utils/users/users.ts | 22 |
1 files changed, 22 insertions, 0 deletions
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, | |||
134 | .expect(expectedStatus) | 134 | .expect(expectedStatus) |
135 | } | 135 | } |
136 | 136 | ||
137 | function blockUser (url: string, userId: number | string, accessToken: string, expectedStatus = 204) { | ||
138 | const path = '/api/v1/users' | ||
139 | |||
140 | return request(url) | ||
141 | .post(path + '/' + userId + '/block') | ||
142 | .set('Accept', 'application/json') | ||
143 | .set('Authorization', 'Bearer ' + accessToken) | ||
144 | .expect(expectedStatus) | ||
145 | } | ||
146 | |||
147 | function unblockUser (url: string, userId: number | string, accessToken: string, expectedStatus = 204) { | ||
148 | const path = '/api/v1/users' | ||
149 | |||
150 | return request(url) | ||
151 | .post(path + '/' + userId + '/unblock') | ||
152 | .set('Accept', 'application/json') | ||
153 | .set('Authorization', 'Bearer ' + accessToken) | ||
154 | .expect(expectedStatus) | ||
155 | } | ||
156 | |||
137 | function updateMyUser (options: { | 157 | function updateMyUser (options: { |
138 | url: string | 158 | url: string |
139 | accessToken: string, | 159 | accessToken: string, |
@@ -234,6 +254,8 @@ export { | |||
234 | updateUser, | 254 | updateUser, |
235 | updateMyUser, | 255 | updateMyUser, |
236 | getUserInformation, | 256 | getUserInformation, |
257 | blockUser, | ||
258 | unblockUser, | ||
237 | askResetPassword, | 259 | askResetPassword, |
238 | resetPassword, | 260 | resetPassword, |
239 | updateMyAvatar | 261 | updateMyAvatar |