]>
Commit | Line | Data |
---|---|---|
a1587156 | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
265ba139 C |
2 | |
3 | import 'mocha' | |
9639bd17 | 4 | import { |
5 | checkBadCountPagination, | |
6 | checkBadSortPagination, | |
9fff08cf C |
7 | checkBadStartPagination, |
8 | cleanupTests, | |
254d3579 C |
9 | createSingleServer, |
10 | PeerTubeServer | |
9fff08cf | 11 | } from '@shared/extra-utils' |
4c7e60bc | 12 | import { HttpStatusCode } from '@shared/models' |
265ba139 | 13 | |
926cd3df | 14 | describe('Test accounts API validators', function () { |
265ba139 | 15 | const path = '/api/v1/accounts/' |
254d3579 | 16 | let server: PeerTubeServer |
265ba139 C |
17 | |
18 | // --------------------------------------------------------------- | |
19 | ||
20 | before(async function () { | |
e212f887 | 21 | this.timeout(30000) |
265ba139 | 22 | |
254d3579 | 23 | server = await createSingleServer(1) |
265ba139 C |
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 () { | |
9fff08cf | 41 | |
ad9e39fb | 42 | it('Should return 404 with a non existing name', async function () { |
89d241a7 | 43 | await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
265ba139 C |
44 | }) |
45 | }) | |
46 | ||
86ebdf8c C |
47 | after(async function () { |
48 | await cleanupTests([ server ]) | |
265ba139 C |
49 | }) |
50 | }) |