diff options
Diffstat (limited to 'server/tests/api/check-params/users.ts')
-rw-r--r-- | server/tests/api/check-params/users.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index b0f35b9f7..9938fe3a2 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -20,6 +20,10 @@ describe('Test users API validators', function () { | |||
20 | let server: ServerInfo | 20 | let server: ServerInfo |
21 | let serverWithRegistrationDisabled: ServerInfo | 21 | let serverWithRegistrationDisabled: ServerInfo |
22 | let userAccessToken = '' | 22 | let userAccessToken = '' |
23 | const user = { | ||
24 | username: 'user1', | ||
25 | password: 'my super password' | ||
26 | } | ||
23 | 27 | ||
24 | // --------------------------------------------------------------- | 28 | // --------------------------------------------------------------- |
25 | 29 | ||
@@ -33,10 +37,6 @@ describe('Test users API validators', function () { | |||
33 | 37 | ||
34 | await setAccessTokensToServers([ server ]) | 38 | await setAccessTokensToServers([ server ]) |
35 | 39 | ||
36 | const user = { | ||
37 | username: 'user1', | ||
38 | password: 'my super password' | ||
39 | } | ||
40 | const videoQuota = 42000000 | 40 | const videoQuota = 42000000 |
41 | await createUser(server.url, server.accessToken, user.username, user.password, videoQuota) | 41 | await createUser(server.url, server.accessToken, user.username, user.password, videoQuota) |
42 | userAccessToken = await userLogin(server, user) | 42 | userAccessToken = await userLogin(server, user) |
@@ -341,6 +341,14 @@ describe('Test users API validators', function () { | |||
341 | await makePutBodyRequest({ url: server.url, path: path + userId, token: 'super token', fields, statusCodeExpected: 401 }) | 341 | await makePutBodyRequest({ url: server.url, path: path + userId, token: 'super token', fields, statusCodeExpected: 401 }) |
342 | }) | 342 | }) |
343 | 343 | ||
344 | it('Should fail when updating root role', async function () { | ||
345 | const fields = { | ||
346 | role: UserRole.MODERATOR | ||
347 | } | ||
348 | |||
349 | await makePutBodyRequest({ url: server.url, path: path + rootId, token: server.accessToken, fields }) | ||
350 | }) | ||
351 | |||
344 | it('Should succeed with the correct params', async function () { | 352 | it('Should succeed with the correct params', async function () { |
345 | const fields = { | 353 | const fields = { |
346 | email: 'email@example.com', | 354 | email: 'email@example.com', |
@@ -349,6 +357,7 @@ describe('Test users API validators', function () { | |||
349 | } | 357 | } |
350 | 358 | ||
351 | await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields, statusCodeExpected: 204 }) | 359 | await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields, statusCodeExpected: 204 }) |
360 | userAccessToken = await userLogin(server, user) | ||
352 | }) | 361 | }) |
353 | }) | 362 | }) |
354 | 363 | ||