diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-29 13:18:05 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-29 13:18:05 +0100 |
commit | 86d13ec2aa94ec10810ddf9c8b33314bd4968791 (patch) | |
tree | 5c4175325362df2a92e367dc4077e53a700bfbad /server/tests/api/users.ts | |
parent | 165cdc75bf1942ed687f78094c2bd366839a7c99 (diff) | |
download | PeerTube-86d13ec2aa94ec10810ddf9c8b33314bd4968791.tar.gz PeerTube-86d13ec2aa94ec10810ddf9c8b33314bd4968791.tar.zst PeerTube-86d13ec2aa94ec10810ddf9c8b33314bd4968791.zip |
Users list only available when use is authenticated
And has a special right
Diffstat (limited to 'server/tests/api/users.ts')
-rw-r--r-- | server/tests/api/users.ts | 14 |
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 | |||
2 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
3 | import 'mocha' | 4 | import 'mocha' |
4 | import { UserRole } from '../../../shared' | 5 | import { UserRole } from '../../../shared' |
@@ -28,6 +29,7 @@ import { | |||
28 | } from '../utils' | 29 | } from '../utils' |
29 | import { follow } from '../utils/follows' | 30 | import { follow } from '../utils/follows' |
30 | import { getMyVideos } from '../utils/videos' | 31 | import { getMyVideos } from '../utils/videos' |
32 | import { setAccessTokensToServers } from '../utils/login' | ||
31 | 33 | ||
32 | const expect = chai.expect | 34 | const 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 |