aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-08 14:58:21 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 15:22:58 +0200
commite69219184b1a3262ec5e617d30337b6431c9840c (patch)
tree959b32e1ed28047052604941870563e946be9de1 /server/tests/utils/users
parent6b09aba90dfe4c61331b66b1a6ef1f58ddc61485 (diff)
downloadPeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.tar.gz
PeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.tar.zst
PeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.zip
Implement user blocking on server side
Diffstat (limited to 'server/tests/utils/users')
-rw-r--r--server/tests/utils/users/users.ts22
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
137function 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
147function 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
137function updateMyUser (options: { 157function 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