1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Add ability to sort videos list

This commit is contained in:
Chocobozzz 2016-05-17 21:03:00 +02:00
parent 479f229198
commit a877d5acc5
11 changed files with 173 additions and 9 deletions

View file

@ -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)