Add about page
[oweals/peertube.git] / server / tests / utils / server / jobs.ts
1 import * as request from 'supertest'
2 import { JobState } from '../../../../shared/models'
3
4 function getJobsList (url: string, accessToken: string, state: JobState) {
5   const path = '/api/v1/jobs/' + state
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
15 function getJobsListPaginationAndSort (url: string, accessToken: string, state: JobState, start: number, count: number, sort: string) {
16   const path = '/api/v1/jobs/' + state
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
31 export {
32   getJobsList,
33   getJobsListPaginationAndSort
34 }