aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/api/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/api/utils.js')
-rw-r--r--test/api/utils.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/test/api/utils.js b/test/api/utils.js
index 8d059b01c..b00890539 100644
--- a/test/api/utils.js
+++ b/test/api/utils.js
@@ -34,13 +34,36 @@
34 .end(end) 34 .end(end)
35 } 35 }
36 36
37 function makeFriend (url, callback) { 37 function makeFriends (url, expected_status, callback) {
38 if (!callback) {
39 callback = expected_status
40 expected_status = 204
41 }
42
38 var path = '/api/v1/pods/makefriends' 43 var path = '/api/v1/pods/makefriends'
39 44
40 // The first pod make friend with the third 45 // The first pod make friend with the third
41 request(url) 46 request(url)
42 .get(path) 47 .get(path)
43 .set('Accept', 'application/json') 48 .set('Accept', 'application/json')
49 .expect(expected_status)
50 .end(function (err, res) {
51 if (err) throw err
52
53 // Wait for the request between pods
54 setTimeout(function () {
55 callback()
56 }, 1000)
57 })
58 }
59
60 function quitFriends (url, callback) {
61 var path = '/api/v1/pods/quitfriends'
62
63 // The first pod make friend with the third
64 request(url)
65 .get(path)
66 .set('Accept', 'application/json')
44 .expect(204) 67 .expect(204)
45 .end(function (err, res) { 68 .end(function (err, res) {
46 if (err) throw err 69 if (err) throw err
@@ -152,7 +175,8 @@
152 flushTests: flushTests, 175 flushTests: flushTests,
153 getFriendsList: getFriendsList, 176 getFriendsList: getFriendsList,
154 getVideosList: getVideosList, 177 getVideosList: getVideosList,
155 makeFriend: makeFriend, 178 makeFriends: makeFriends,
179 quitFriends: quitFriends,
156 removeVideo: removeVideo, 180 removeVideo: removeVideo,
157 runMultipleServers: runMultipleServers, 181 runMultipleServers: runMultipleServers,
158 runServer: runServer, 182 runServer: runServer,