getFriendsList: getFriendsList,
getVideo: getVideo,
getVideosList: getVideosList,
+ getVideosListPagination: getVideosListPagination,
login: login,
loginAndGetAccessToken: loginAndGetAccessToken,
makeFriends: makeFriends,
flushAndRunMultipleServers: flushAndRunMultipleServers,
runServer: runServer,
searchVideo: searchVideo,
+ searchVideoWithPagination: searchVideoWithPagination,
testImage: testImage,
uploadVideo: uploadVideo
}
.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
})
}
-function makeFriends (url, expectedStatus, callback) {
+function makeFriends (url, accessToken, expectedStatus, callback) {
if (!callback) {
callback = expectedStatus
expectedStatus = 204
request(url)
.get(path)
.set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + accessToken)
.expect(expectedStatus)
.end(function (err, res) {
if (err) throw err
})
}
-function quitFriends (url, callback) {
+function quitFriends (url, accessToken, expectedStatus, callback) {
+ if (!callback) {
+ callback = expectedStatus
+ expectedStatus = 204
+ }
+
const path = '/api/v1/pods/quitfriends'
// The first pod make friend with the third
request(url)
.get(path)
.set('Accept', 'application/json')
- .expect(204)
+ .set('Authorization', 'Bearer ' + accessToken)
+ .expect(expectedStatus)
.end(function (err, res) {
if (err) throw err
.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)