aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/users.ts')
-rw-r--r--server/tests/api/check-params/users.ts24
1 files changed, 22 insertions, 2 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index f3ee99e85..b5c812e8f 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -19,6 +19,7 @@ import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from
19import { VideoPrivacy } from '../../../../shared/models/videos' 19import { VideoPrivacy } from '../../../../shared/models/videos'
20import { waitJobs } from '../../../../shared/utils/server/jobs' 20import { waitJobs } from '../../../../shared/utils/server/jobs'
21import { expect } from 'chai' 21import { expect } from 'chai'
22import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
22 23
23describe('Test users API validators', function () { 24describe('Test users API validators', function () {
24 const path = '/api/v1/users/' 25 const path = '/api/v1/users/'
@@ -47,7 +48,13 @@ describe('Test users API validators', function () {
47 await setAccessTokensToServers([ server ]) 48 await setAccessTokensToServers([ server ])
48 49
49 const videoQuota = 42000000 50 const videoQuota = 42000000
50 await createUser(server.url, server.accessToken, user.username, user.password, videoQuota) 51 await createUser({
52 url: server.url,
53 accessToken: server.accessToken,
54 username: user.username,
55 password: user.password,
56 videoQuota: videoQuota
57 })
51 userAccessToken = await userLogin(server, user) 58 userAccessToken = await userLogin(server, user)
52 59
53 { 60 {
@@ -99,7 +106,8 @@ describe('Test users API validators', function () {
99 password: 'my super password', 106 password: 'my super password',
100 videoQuota: -1, 107 videoQuota: -1,
101 videoQuotaDaily: -1, 108 videoQuotaDaily: -1,
102 role: UserRole.USER 109 role: UserRole.USER,
110 adminFlags: UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST
103 } 111 }
104 112
105 it('Should fail with a too small username', async function () { 113 it('Should fail with a too small username', async function () {
@@ -150,6 +158,12 @@ describe('Test users API validators', function () {
150 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 158 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
151 }) 159 })
152 160
161 it('Should fail with invalid admin flags', async function () {
162 const fields = immutableAssign(baseCorrectParams, { adminFlags: 'toto' })
163
164 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
165 })
166
153 it('Should fail with an non authenticated user', async function () { 167 it('Should fail with an non authenticated user', async function () {
154 await makePostBodyRequest({ 168 await makePostBodyRequest({
155 url: server.url, 169 url: server.url,
@@ -498,6 +512,12 @@ describe('Test users API validators', function () {
498 await makePutBodyRequest({ url: server.url, path: path + rootId, token: server.accessToken, fields }) 512 await makePutBodyRequest({ url: server.url, path: path + rootId, token: server.accessToken, fields })
499 }) 513 })
500 514
515 it('Should fail with invalid admin flags', async function () {
516 const fields = { adminFlags: 'toto' }
517
518 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
519 })
520
501 it('Should succeed with the correct params', async function () { 521 it('Should succeed with the correct params', async function () {
502 const fields = { 522 const fields = {
503 email: 'email@example.com', 523 email: 'email@example.com',