Fix images size limit
[oweals/peertube.git] / server / tests / api / check-params / accounts.ts
1 /* tslint:disable:no-unused-expression */
2
3 import 'mocha'
4
5 import { flushTests, killallServers, runServer, ServerInfo } from '../../utils'
6 import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
7 import { getAccount } from '../../utils/users/accounts'
8
9 describe('Test users API validators', function () {
10   const path = '/api/v1/accounts/'
11   let server: ServerInfo
12
13   // ---------------------------------------------------------------
14
15   before(async function () {
16     this.timeout(30000)
17
18     await flushTests()
19
20     server = await runServer(1)
21   })
22
23   describe('When listing accounts', function () {
24     it('Should fail with a bad start pagination', async function () {
25       await checkBadStartPagination(server.url, path, server.accessToken)
26     })
27
28     it('Should fail with a bad count pagination', async function () {
29       await checkBadCountPagination(server.url, path, server.accessToken)
30     })
31
32     it('Should fail with an incorrect sort', async function () {
33       await checkBadSortPagination(server.url, path, server.accessToken)
34     })
35   })
36
37   describe('When getting an account', function () {
38     it('Should return 404 with a non existing name', async function () {
39       await getAccount(server.url, 'arfaze', 404)
40     })
41   })
42
43   after(async function () {
44     killallServers([ server ])
45
46     // Keep the logs if the test failed
47     if (this['ok']) {
48       await flushTests()
49     }
50   })
51 })