]>
Commit | Line | Data |
---|---|---|
a1587156 | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
265ba139 C |
2 | |
3 | import 'mocha' | |
c55e3d72 | 4 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' |
4c7e60bc | 5 | import { HttpStatusCode } from '@shared/models' |
c55e3d72 | 6 | import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands' |
265ba139 | 7 | |
926cd3df | 8 | describe('Test accounts API validators', function () { |
265ba139 | 9 | const path = '/api/v1/accounts/' |
254d3579 | 10 | let server: PeerTubeServer |
265ba139 C |
11 | |
12 | // --------------------------------------------------------------- | |
13 | ||
14 | before(async function () { | |
e212f887 | 15 | this.timeout(30000) |
265ba139 | 16 | |
254d3579 | 17 | server = await createSingleServer(1) |
265ba139 C |
18 | }) |
19 | ||
20 | describe('When listing accounts', function () { | |
21 | it('Should fail with a bad start pagination', async function () { | |
22 | await checkBadStartPagination(server.url, path, server.accessToken) | |
23 | }) | |
24 | ||
25 | it('Should fail with a bad count pagination', async function () { | |
26 | await checkBadCountPagination(server.url, path, server.accessToken) | |
27 | }) | |
28 | ||
29 | it('Should fail with an incorrect sort', async function () { | |
30 | await checkBadSortPagination(server.url, path, server.accessToken) | |
31 | }) | |
32 | }) | |
33 | ||
34 | describe('When getting an account', function () { | |
9fff08cf | 35 | |
ad9e39fb | 36 | it('Should return 404 with a non existing name', async function () { |
89d241a7 | 37 | await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
265ba139 C |
38 | }) |
39 | }) | |
40 | ||
86ebdf8c C |
41 | after(async function () { |
42 | await cleanupTests([ server ]) | |
265ba139 C |
43 | }) |
44 | }) |