]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/utils/server/jobs.ts
Add concept of video state, and add ability to wait transcoding before
[github/Chocobozzz/PeerTube.git] / server / tests / utils / server / jobs.ts
CommitLineData
5cd80545 1import * as request from 'supertest'
94a5ff8a 2import { JobState } from '../../../../shared/models'
5cd80545 3
94a5ff8a
C
4function getJobsList (url: string, accessToken: string, state: JobState) {
5 const path = '/api/v1/jobs/' + state
5cd80545
C
6
7 return request(url)
8 .get(path)
9 .set('Accept', 'application/json')
10 .set('Authorization', 'Bearer ' + accessToken)
11 .expect(200)
12 .expect('Content-Type', /json/)
13}
14
94a5ff8a
C
15function getJobsListPaginationAndSort (url: string, accessToken: string, state: JobState, start: number, count: number, sort: string) {
16 const path = '/api/v1/jobs/' + state
5cd80545
C
17
18 return request(url)
19 .get(path)
20 .query({ start })
21 .query({ count })
22 .query({ sort })
23 .set('Accept', 'application/json')
24 .set('Authorization', 'Bearer ' + accessToken)
25 .expect(200)
26 .expect('Content-Type', /json/)
27}
28
29// ---------------------------------------------------------------------------
30
31export {
32 getJobsList,
33 getJobsListPaginationAndSort
34}