aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/users.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/tests/utils/users.js b/server/tests/utils/users.js
index 7817160b9..8138074d0 100644
--- a/server/tests/utils/users.js
+++ b/server/tests/utils/users.js
@@ -101,14 +101,18 @@ function removeUser (url, userId, accessToken, expectedStatus, end) {
101 .end(end) 101 .end(end)
102} 102}
103 103
104function updateUser (url, userId, accessToken, newPassword, end) { 104function updateUser (url, userId, accessToken, newPassword, displayNSFW, end) {
105 const path = '/api/v1/users/' + userId 105 const path = '/api/v1/users/' + userId
106 106
107 const toSend = {}
108 if (newPassword !== undefined && newPassword !== null) toSend.password = newPassword
109 if (displayNSFW !== undefined && displayNSFW !== null) toSend.displayNSFW = displayNSFW
110
107 request(url) 111 request(url)
108 .put(path) 112 .put(path)
109 .set('Accept', 'application/json') 113 .set('Accept', 'application/json')
110 .set('Authorization', 'Bearer ' + accessToken) 114 .set('Authorization', 'Bearer ' + accessToken)
111 .send({ password: newPassword }) 115 .send(toSend)
112 .expect(204) 116 .expect(204)
113 .end(end) 117 .end(end)
114} 118}