From a877d5acc5c52b8667c65f725bbca9a52e40ec48 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 May 2016 21:03:00 +0200 Subject: Add ability to sort videos list --- server/tests/api/utils.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'server/tests/api/utils.js') 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 = { getVideo: getVideo, getVideosList: getVideosList, getVideosListPagination: getVideosListPagination, + getVideosListSort: getVideosListSort, login: login, loginAndGetAccessToken: loginAndGetAccessToken, makeFriends: makeFriends, @@ -23,6 +24,7 @@ const testUtils = { runServer: runServer, searchVideo: searchVideo, searchVideoWithPagination: searchVideoWithPagination, + searchVideoWithSort: searchVideoWithSort, testImage: testImage, uploadVideo: uploadVideo } @@ -89,6 +91,18 @@ function getVideosListPagination (url, start, count, end) { .end(end) } +function getVideosListSort (url, sort, end) { + const path = '/api/v1/videos' + + request(url) + .get(path) + .query({ sort: sort }) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) + .end(end) +} + function login (url, client, user, expectedStatus, end) { if (!end) { end = expectedStatus @@ -300,6 +314,18 @@ function searchVideoWithPagination (url, search, start, count, end) { .end(end) } +function searchVideoWithSort (url, search, sort, end) { + const path = '/api/v1/videos' + + request(url) + .get(path + '/search/' + search) + .query({ sort: sort }) + .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