aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/users
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/users')
-rw-r--r--server/tests/utils/users/users.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts
index 7e15fc86e..f786de6e3 100644
--- a/server/tests/utils/users/users.ts
+++ b/server/tests/utils/users/users.ts
@@ -134,11 +134,14 @@ 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) { 137function blockUser (url: string, userId: number | string, accessToken: string, expectedStatus = 204, reason?: string) {
138 const path = '/api/v1/users' 138 const path = '/api/v1/users'
139 let body: any
140 if (reason) body = { reason }
139 141
140 return request(url) 142 return request(url)
141 .post(path + '/' + userId + '/block') 143 .post(path + '/' + userId + '/block')
144 .send(body)
142 .set('Accept', 'application/json') 145 .set('Accept', 'application/json')
143 .set('Authorization', 'Bearer ' + accessToken) 146 .set('Authorization', 'Bearer ' + accessToken)
144 .expect(expectedStatus) 147 .expect(expectedStatus)