]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/api/check-params/accounts.ts
Introduce accounts command
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / accounts.ts
1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3 import 'mocha'
4 import { HttpStatusCode } from '@shared/core-utils'
5 import {
6 checkBadCountPagination,
7 checkBadSortPagination,
8 checkBadStartPagination,
9 cleanupTests,
10 flushAndRunServer,
11 ServerInfo
12 } from '@shared/extra-utils'
13
14 describe('Test accounts API validators', function () {
15 const path = '/api/v1/accounts/'
16 let server: ServerInfo
17
18 // ---------------------------------------------------------------
19
20 before(async function () {
21 this.timeout(30000)
22
23 server = await flushAndRunServer(1)
24 })
25
26 describe('When listing accounts', function () {
27 it('Should fail with a bad start pagination', async function () {
28 await checkBadStartPagination(server.url, path, server.accessToken)
29 })
30
31 it('Should fail with a bad count pagination', async function () {
32 await checkBadCountPagination(server.url, path, server.accessToken)
33 })
34
35 it('Should fail with an incorrect sort', async function () {
36 await checkBadSortPagination(server.url, path, server.accessToken)
37 })
38 })
39
40 describe('When getting an account', function () {
41
42 it('Should return 404 with a non existing name', async function () {
43 await server.accountsCommand.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
44 })
45 })
46
47 after(async function () {
48 await cleanupTests([ server ])
49 })
50 })