aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-23 09:15:36 +0100
committerChocobozzz <me@florianbigard.com>2018-01-23 09:49:57 +0100
commitf8b8c36b2a92bfee435747ab5a0283924be76281 (patch)
tree99e17a5c9413614071ae63d72e9b9557fc8cef43 /server/tests/api/check-params
parent59c48d49c5f06a46c342b4e7f86fbd1ed9894bd6 (diff)
downloadPeerTube-f8b8c36b2a92bfee435747ab5a0283924be76281.tar.gz
PeerTube-f8b8c36b2a92bfee435747ab5a0283924be76281.tar.zst
PeerTube-f8b8c36b2a92bfee435747ab5a0283924be76281.zip
Destroy user token when changing its role
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/users.ts17
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