diff options
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r-- | server/tests/utils/videos/videos.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 01e7fa5a1..df9071c29 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -128,6 +128,18 @@ function getVideosList (url: string) { | |||
128 | .expect('Content-Type', /json/) | 128 | .expect('Content-Type', /json/) |
129 | } | 129 | } |
130 | 130 | ||
131 | function getVideosListWithToken (url: string, token: string) { | ||
132 | const path = '/api/v1/videos' | ||
133 | |||
134 | return request(url) | ||
135 | .get(path) | ||
136 | .set('Authorization', 'Bearer ' + token) | ||
137 | .query({ sort: 'name' }) | ||
138 | .set('Accept', 'application/json') | ||
139 | .expect(200) | ||
140 | .expect('Content-Type', /json/) | ||
141 | } | ||
142 | |||
131 | function getLocalVideos (url: string) { | 143 | function getLocalVideos (url: string) { |
132 | const path = '/api/v1/videos' | 144 | const path = '/api/v1/videos' |
133 | 145 | ||
@@ -202,6 +214,18 @@ function searchVideo (url: string, search: string) { | |||
202 | .expect('Content-Type', /json/) | 214 | .expect('Content-Type', /json/) |
203 | } | 215 | } |
204 | 216 | ||
217 | function searchVideoWithToken (url: string, search: string, token: string) { | ||
218 | const path = '/api/v1/videos' | ||
219 | const req = request(url) | ||
220 | .get(path + '/search') | ||
221 | .set('Authorization', 'Bearer ' + token) | ||
222 | .query({ search }) | ||
223 | .set('Accept', 'application/json') | ||
224 | |||
225 | return req.expect(200) | ||
226 | .expect('Content-Type', /json/) | ||
227 | } | ||
228 | |||
205 | function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { | 229 | function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { |
206 | const path = '/api/v1/videos' | 230 | const path = '/api/v1/videos' |
207 | 231 | ||
@@ -490,6 +514,7 @@ export { | |||
490 | getVideoPrivacies, | 514 | getVideoPrivacies, |
491 | getVideoLanguages, | 515 | getVideoLanguages, |
492 | getMyVideos, | 516 | getMyVideos, |
517 | searchVideoWithToken, | ||
493 | getVideo, | 518 | getVideo, |
494 | getVideoWithToken, | 519 | getVideoWithToken, |
495 | getVideosList, | 520 | getVideosList, |
@@ -499,6 +524,7 @@ export { | |||
499 | searchVideo, | 524 | searchVideo, |
500 | searchVideoWithPagination, | 525 | searchVideoWithPagination, |
501 | searchVideoWithSort, | 526 | searchVideoWithSort, |
527 | getVideosListWithToken, | ||
502 | uploadVideo, | 528 | uploadVideo, |
503 | updateVideo, | 529 | updateVideo, |
504 | rateVideo, | 530 | rateVideo, |