From fbf1134e3e6b386c9ec5a3946c61f3faf84397fb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 13 May 2016 18:10:46 +0200 Subject: Introduce paginations in videos listing --- server/tests/api/utils.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'server/tests/api/utils.js') 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 = { getFriendsList: getFriendsList, getVideo: getVideo, getVideosList: getVideosList, + getVideosListPagination: getVideosListPagination, login: login, loginAndGetAccessToken: loginAndGetAccessToken, makeFriends: makeFriends, @@ -20,6 +21,7 @@ const testUtils = { flushAndRunMultipleServers: flushAndRunMultipleServers, runServer: runServer, searchVideo: searchVideo, + searchVideoWithPagination: searchVideoWithPagination, testImage: testImage, uploadVideo: uploadVideo } @@ -63,6 +65,19 @@ function getVideosList (url, end) { .end(end) } +function getVideosListPagination (url, start, count, end) { + const path = '/api/v1/videos' + + request(url) + .get(path) + .query({ start: start }) + .query({ count: count }) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) + .end(end) +} + function login (url, client, user, expectedStatus, end) { if (!end) { end = expectedStatus @@ -261,6 +276,19 @@ function searchVideo (url, search, end) { .end(end) } +function searchVideoWithPagination (url, search, start, count, end) { + const path = '/api/v1/videos' + + request(url) + .get(path + '/search/' + search) + .query({ start: start }) + .query({ count: count }) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) + .end(end) +} + function testImage (url, videoName, imagePath, callback) { request(url) .get(imagePath) -- cgit v1.2.3