diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-22 09:15:00 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-22 09:15:00 +0200 |
commit | 46246b5f194caafba4e3a72e9365acd8b35785de (patch) | |
tree | 943689b44a9e447872cd7dd1c2a70dcc9256b990 /server/tests/api/utils.js | |
parent | 68ce3ae021c9bc11b155044df6d23ba60e91eee4 (diff) | |
download | PeerTube-46246b5f194caafba4e3a72e9365acd8b35785de.tar.gz PeerTube-46246b5f194caafba4e3a72e9365acd8b35785de.tar.zst PeerTube-46246b5f194caafba4e3a72e9365acd8b35785de.zip |
Extends the search feature by customizing the search field (name,
podUrl...)
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r-- | server/tests/api/utils.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index 218b46157..c6430c930 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -291,24 +291,31 @@ function runServer (number, callback) { | |||
291 | }) | 291 | }) |
292 | } | 292 | } |
293 | 293 | ||
294 | function searchVideo (url, search, end) { | 294 | function searchVideo (url, search, field, end) { |
295 | const path = '/api/v1/videos' | 295 | if (!end) { |
296 | end = field | ||
297 | field = null | ||
298 | } | ||
296 | 299 | ||
297 | request(url) | 300 | const path = '/api/v1/videos' |
298 | .get(path + '/search/' + search) | 301 | const req = request(url) |
299 | .set('Accept', 'application/json') | 302 | .get(path + '/search/' + search) |
300 | .expect(200) | 303 | .set('Accept', 'application/json') |
301 | .expect('Content-Type', /json/) | 304 | |
302 | .end(end) | 305 | if (field) req.query({ field: field }) |
306 | req.expect(200) | ||
307 | .expect('Content-Type', /json/) | ||
308 | .end(end) | ||
303 | } | 309 | } |
304 | 310 | ||
305 | function searchVideoWithPagination (url, search, start, count, end) { | 311 | function searchVideoWithPagination (url, search, field, start, count, end) { |
306 | const path = '/api/v1/videos' | 312 | const path = '/api/v1/videos' |
307 | 313 | ||
308 | request(url) | 314 | request(url) |
309 | .get(path + '/search/' + search) | 315 | .get(path + '/search/' + search) |
310 | .query({ start: start }) | 316 | .query({ start: start }) |
311 | .query({ count: count }) | 317 | .query({ count: count }) |
318 | .query({ field: field }) | ||
312 | .set('Accept', 'application/json') | 319 | .set('Accept', 'application/json') |
313 | .expect(200) | 320 | .expect(200) |
314 | .expect('Content-Type', /json/) | 321 | .expect('Content-Type', /json/) |