aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users/users.ts')
-rw-r--r--server/tests/api/users/users.ts60
1 files changed, 32 insertions, 28 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index ec164cadc..b7ec3bc0f 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -4,32 +4,13 @@ import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { UserRole } from '../../../../shared/index' 5import { UserRole } from '../../../../shared/index'
6import { 6import {
7 createUser, 7 createUser, flushTests, getBlacklistedVideosList, getMyUserInformation, getMyUserVideoRating, getUserInformation, getUsersList,
8 flushTests, 8 getUsersListPaginationAndSort, getVideosList, killallServers, login, makePutBodyRequest, rateVideo, registerUser, removeUser, removeVideo,
9 getBlacklistedVideosList, 9 runServer, ServerInfo, serverLogin, updateMyUser, updateUser, uploadVideo
10 getMyUserInformation,
11 getUserInformation,
12 getUsersList,
13 getUsersListPaginationAndSort,
14 getMyUserVideoRating,
15 getVideosList,
16 killallServers,
17 login,
18 serverLogin,
19 makePutBodyRequest,
20 rateVideo,
21 registerUser,
22 removeUser,
23 removeVideo,
24 runServer,
25 ServerInfo,
26 updateMyUser,
27 updateUser,
28 uploadVideo
29} from '../../utils/index' 10} from '../../utils/index'
30import { follow } from '../../utils/server/follows' 11import { follow } from '../../utils/server/follows'
31import { getMyVideos } from '../../utils/videos/videos'
32import { setAccessTokensToServers } from '../../utils/users/login' 12import { setAccessTokensToServers } from '../../utils/users/login'
13import { getMyVideos } from '../../utils/videos/videos'
33 14
34const expect = chai.expect 15const expect = chai.expect
35 16
@@ -387,14 +368,22 @@ describe('Test users', function () {
387 }) 368 })
388 369
389 it('Should update my password', async function () { 370 it('Should update my password', async function () {
390 await updateMyUser(server.url, accessTokenUser, 'new password') 371 await updateMyUser({
372 url: server.url,
373 accessToken: accessTokenUser,
374 newPassword: 'new password'
375 })
391 server.user.password = 'new password' 376 server.user.password = 'new password'
392 377
393 await login(server.url, server.client, server.user, 200) 378 await login(server.url, server.client, server.user, 200)
394 }) 379 })
395 380
396 it('Should be able to change the NSFW display attribute', async function () { 381 it('Should be able to change the NSFW display attribute', async function () {
397 await updateMyUser(server.url, accessTokenUser, undefined, true) 382 await updateMyUser({
383 url: server.url,
384 accessToken: accessTokenUser,
385 displayNSFW: true
386 })
398 387
399 const res = await getMyUserInformation(server.url, accessTokenUser) 388 const res = await getMyUserInformation(server.url, accessTokenUser)
400 const user = res.body 389 const user = res.body
@@ -416,7 +405,11 @@ describe('Test users', function () {
416 }) 405 })
417 406
418 it('Should be able to change the autoPlayVideo attribute', async function () { 407 it('Should be able to change the autoPlayVideo attribute', async function () {
419 await updateMyUser(server.url, accessTokenUser, undefined, undefined, undefined, false) 408 await updateMyUser({
409 url: server.url,
410 accessToken: accessTokenUser,
411 autoPlayVideo: false
412 })
420 413
421 const res = await getMyUserInformation(server.url, accessTokenUser) 414 const res = await getMyUserInformation(server.url, accessTokenUser)
422 const user = res.body 415 const user = res.body
@@ -425,7 +418,11 @@ describe('Test users', function () {
425 }) 418 })
426 419
427 it('Should be able to change the email display attribute', async function () { 420 it('Should be able to change the email display attribute', async function () {
428 await updateMyUser(server.url, accessTokenUser, undefined, undefined, 'updated@example.com') 421 await updateMyUser({
422 url: server.url,
423 accessToken: accessTokenUser,
424 email: 'updated@example.com'
425 })
429 426
430 const res = await getMyUserInformation(server.url, accessTokenUser) 427 const res = await getMyUserInformation(server.url, accessTokenUser)
431 const user = res.body 428 const user = res.body
@@ -447,7 +444,14 @@ describe('Test users', function () {
447 }) 444 })
448 445
449 it('Should be able to update another user', async function () { 446 it('Should be able to update another user', async function () {
450 await updateUser(server.url, userId, accessToken, 'updated2@example.com', 42, UserRole.MODERATOR) 447 await updateUser({
448 url: server.url,
449 userId,
450 accessToken,
451 email: 'updated2@example.com',
452 videoQuota: 42,
453 role: UserRole.MODERATOR
454 })
451 455
452 const res = await getUserInformation(server.url, accessToken, userId) 456 const res = await getUserInformation(server.url, accessToken, userId)
453 const user = res.body 457 const user = res.body