diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-23 18:31:58 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-23 18:31:58 +0100 |
commit | 45239549bf2659998dcf9196d86974b0b625912e (patch) | |
tree | 823d324db097400a7b5ae59a03deff54c5fd86ef /test/api/utils.js | |
parent | 2cc8ebf134b66047cd639ee7324e1ecfd5c5fd18 (diff) | |
download | PeerTube-45239549bf2659998dcf9196d86974b0b625912e.tar.gz PeerTube-45239549bf2659998dcf9196d86974b0b625912e.tar.zst PeerTube-45239549bf2659998dcf9196d86974b0b625912e.zip |
Finalise the join in a network and add the ability to quit it
Diffstat (limited to 'test/api/utils.js')
-rw-r--r-- | test/api/utils.js | 28 |
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, |