aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users.ts')
-rw-r--r--server/tests/api/users.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/server/tests/api/users.ts b/server/tests/api/users.ts
index 5c0531571..33646e84f 100644
--- a/server/tests/api/users.ts
+++ b/server/tests/api/users.ts
@@ -1,4 +1,5 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2
2import * as chai from 'chai' 3import * as chai from 'chai'
3import 'mocha' 4import 'mocha'
4import { UserRole } from '../../../shared' 5import { UserRole } from '../../../shared'
@@ -28,6 +29,7 @@ import {
28} from '../utils' 29} from '../utils'
29import { follow } from '../utils/follows' 30import { follow } from '../utils/follows'
30import { getMyVideos } from '../utils/videos' 31import { getMyVideos } from '../utils/videos'
32import { setAccessTokensToServers } from '../utils/login'
31 33
32const expect = chai.expect 34const expect = chai.expect
33 35
@@ -43,6 +45,8 @@ describe('Test users', function () {
43 45
44 await flushTests() 46 await flushTests()
45 server = await runServer(1) 47 server = await runServer(1)
48
49 await setAccessTokensToServers([ server ])
46 }) 50 })
47 51
48 it('Should create a new client') 52 it('Should create a new client')
@@ -242,7 +246,7 @@ describe('Test users', function () {
242 }) 246 })
243 247
244 it('Should list all the users', async function () { 248 it('Should list all the users', async function () {
245 const res = await getUsersList(server.url) 249 const res = await getUsersList(server.url, server.accessToken)
246 const result = res.body 250 const result = res.body
247 const total = result.total 251 const total = result.total
248 const users = result.data 252 const users = result.data
@@ -280,7 +284,7 @@ describe('Test users', function () {
280 }) 284 })
281 285
282 it('Should list only the first user by username asc', async function () { 286 it('Should list only the first user by username asc', async function () {
283 const res = await getUsersListPaginationAndSort(server.url, 0, 1, 'username') 287 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, 'username')
284 288
285 const result = res.body 289 const result = res.body
286 const total = result.total 290 const total = result.total
@@ -307,7 +311,7 @@ describe('Test users', function () {
307 }) 311 })
308 312
309 it('Should list only the first user by username desc', async function () { 313 it('Should list only the first user by username desc', async function () {
310 const res = await getUsersListPaginationAndSort(server.url, 0, 1, '-username') 314 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-username')
311 const result = res.body 315 const result = res.body
312 const total = result.total 316 const total = result.total
313 const users = result.data 317 const users = result.data
@@ -330,7 +334,7 @@ describe('Test users', function () {
330 }) 334 })
331 335
332 it('Should list only the second user by createdAt desc', async function () { 336 it('Should list only the second user by createdAt desc', async function () {
333 const res = await getUsersListPaginationAndSort(server.url, 0, 1, '-createdAt') 337 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-createdAt')
334 const result = res.body 338 const result = res.body
335 const total = result.total 339 const total = result.total
336 const users = result.data 340 const users = result.data
@@ -353,7 +357,7 @@ describe('Test users', function () {
353 }) 357 })
354 358
355 it('Should list all the users by createdAt asc', async function () { 359 it('Should list all the users by createdAt asc', async function () {
356 const res = await getUsersListPaginationAndSort(server.url, 0, 2, 'createdAt') 360 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt')
357 const result = res.body 361 const result = res.body
358 const total = result.total 362 const total = result.total
359 const users = result.data 363 const users = result.data