aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/utils.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-13 18:10:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-13 18:10:46 +0200
commitfbf1134e3e6b386c9ec5a3946c61f3faf84397fb (patch)
tree9071ea72c86e83bb07d8ec681a54daff2e0eb7b9 /server/tests/api/utils.js
parentf67e976fdccbfe6432c1176148d194c980a5585a (diff)
downloadPeerTube-fbf1134e3e6b386c9ec5a3946c61f3faf84397fb.tar.gz
PeerTube-fbf1134e3e6b386c9ec5a3946c61f3faf84397fb.tar.zst
PeerTube-fbf1134e3e6b386c9ec5a3946c61f3faf84397fb.zip
Introduce paginations in videos listing
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r--server/tests/api/utils.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js
index 9c5e4ee61..f0b1c3653 100644
--- a/server/tests/api/utils.js
+++ b/server/tests/api/utils.js
@@ -12,6 +12,7 @@ const testUtils = {
12 getFriendsList: getFriendsList, 12 getFriendsList: getFriendsList,
13 getVideo: getVideo, 13 getVideo: getVideo,
14 getVideosList: getVideosList, 14 getVideosList: getVideosList,
15 getVideosListPagination: getVideosListPagination,
15 login: login, 16 login: login,
16 loginAndGetAccessToken: loginAndGetAccessToken, 17 loginAndGetAccessToken: loginAndGetAccessToken,
17 makeFriends: makeFriends, 18 makeFriends: makeFriends,
@@ -20,6 +21,7 @@ const testUtils = {
20 flushAndRunMultipleServers: flushAndRunMultipleServers, 21 flushAndRunMultipleServers: flushAndRunMultipleServers,
21 runServer: runServer, 22 runServer: runServer,
22 searchVideo: searchVideo, 23 searchVideo: searchVideo,
24 searchVideoWithPagination: searchVideoWithPagination,
23 testImage: testImage, 25 testImage: testImage,
24 uploadVideo: uploadVideo 26 uploadVideo: uploadVideo
25} 27}
@@ -63,6 +65,19 @@ function getVideosList (url, end) {
63 .end(end) 65 .end(end)
64} 66}
65 67
68function getVideosListPagination (url, start, count, end) {
69 const path = '/api/v1/videos'
70
71 request(url)
72 .get(path)
73 .query({ start: start })
74 .query({ count: count })
75 .set('Accept', 'application/json')
76 .expect(200)
77 .expect('Content-Type', /json/)
78 .end(end)
79}
80
66function login (url, client, user, expectedStatus, end) { 81function login (url, client, user, expectedStatus, end) {
67 if (!end) { 82 if (!end) {
68 end = expectedStatus 83 end = expectedStatus
@@ -261,6 +276,19 @@ function searchVideo (url, search, end) {
261 .end(end) 276 .end(end)
262} 277}
263 278
279function searchVideoWithPagination (url, search, start, count, end) {
280 const path = '/api/v1/videos'
281
282 request(url)
283 .get(path + '/search/' + search)
284 .query({ start: start })
285 .query({ count: count })
286 .set('Accept', 'application/json')
287 .expect(200)
288 .expect('Content-Type', /json/)
289 .end(end)
290}
291
264function testImage (url, videoName, imagePath, callback) { 292function testImage (url, videoName, imagePath, callback) {
265 request(url) 293 request(url)
266 .get(imagePath) 294 .get(imagePath)