diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-17 21:03:00 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-17 21:03:00 +0200 |
commit | a877d5acc5c52b8667c65f725bbca9a52e40ec48 (patch) | |
tree | 20b5dd56f71c7572360807f894e85e0ab729629f /server/tests/api/utils.js | |
parent | 479f229198bdfcfd3a63d02babdddaa8b2209ccb (diff) | |
download | PeerTube-a877d5acc5c52b8667c65f725bbca9a52e40ec48.tar.gz PeerTube-a877d5acc5c52b8667c65f725bbca9a52e40ec48.tar.zst PeerTube-a877d5acc5c52b8667c65f725bbca9a52e40ec48.zip |
Add ability to sort videos list
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r-- | server/tests/api/utils.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index d505cb5d9..ac43946cd 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -14,6 +14,7 @@ const testUtils = { | |||
14 | getVideo: getVideo, | 14 | getVideo: getVideo, |
15 | getVideosList: getVideosList, | 15 | getVideosList: getVideosList, |
16 | getVideosListPagination: getVideosListPagination, | 16 | getVideosListPagination: getVideosListPagination, |
17 | getVideosListSort: getVideosListSort, | ||
17 | login: login, | 18 | login: login, |
18 | loginAndGetAccessToken: loginAndGetAccessToken, | 19 | loginAndGetAccessToken: loginAndGetAccessToken, |
19 | makeFriends: makeFriends, | 20 | makeFriends: makeFriends, |
@@ -23,6 +24,7 @@ const testUtils = { | |||
23 | runServer: runServer, | 24 | runServer: runServer, |
24 | searchVideo: searchVideo, | 25 | searchVideo: searchVideo, |
25 | searchVideoWithPagination: searchVideoWithPagination, | 26 | searchVideoWithPagination: searchVideoWithPagination, |
27 | searchVideoWithSort: searchVideoWithSort, | ||
26 | testImage: testImage, | 28 | testImage: testImage, |
27 | uploadVideo: uploadVideo | 29 | uploadVideo: uploadVideo |
28 | } | 30 | } |
@@ -89,6 +91,18 @@ function getVideosListPagination (url, start, count, end) { | |||
89 | .end(end) | 91 | .end(end) |
90 | } | 92 | } |
91 | 93 | ||
94 | function getVideosListSort (url, sort, end) { | ||
95 | const path = '/api/v1/videos' | ||
96 | |||
97 | request(url) | ||
98 | .get(path) | ||
99 | .query({ sort: sort }) | ||
100 | .set('Accept', 'application/json') | ||
101 | .expect(200) | ||
102 | .expect('Content-Type', /json/) | ||
103 | .end(end) | ||
104 | } | ||
105 | |||
92 | function login (url, client, user, expectedStatus, end) { | 106 | function login (url, client, user, expectedStatus, end) { |
93 | if (!end) { | 107 | if (!end) { |
94 | end = expectedStatus | 108 | end = expectedStatus |
@@ -300,6 +314,18 @@ function searchVideoWithPagination (url, search, start, count, end) { | |||
300 | .end(end) | 314 | .end(end) |
301 | } | 315 | } |
302 | 316 | ||
317 | function searchVideoWithSort (url, search, sort, end) { | ||
318 | const path = '/api/v1/videos' | ||
319 | |||
320 | request(url) | ||
321 | .get(path + '/search/' + search) | ||
322 | .query({ sort: sort }) | ||
323 | .set('Accept', 'application/json') | ||
324 | .expect(200) | ||
325 | .expect('Content-Type', /json/) | ||
326 | .end(end) | ||
327 | } | ||
328 | |||
303 | function testImage (url, videoName, imagePath, callback) { | 329 | function testImage (url, videoName, imagePath, callback) { |
304 | request(url) | 330 | request(url) |
305 | .get(imagePath) | 331 | .get(imagePath) |