aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/friends-basic.js
diff options
context:
space:
mode:
authorGreen-Star <Green-Star@users.noreply.github.com>2017-08-02 21:50:42 +0200
committerBigard Florian <florian.bigard@gmail.com>2017-08-02 21:50:42 +0200
commitd5f5a670fcf6258d0facf9a2fd3aabd550fbc78f (patch)
treebc945e1b6ab0f9cb36a481fea56cdfdaa8b1a341 /server/tests/api/friends-basic.js
parent291e8d3eed88fe714fb74ad897ac2c67347a85ff (diff)
downloadPeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.tar.gz
PeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.tar.zst
PeerTube-d5f5a670fcf6258d0facf9a2fd3aabd550fbc78f.zip
Remove one pod (#76)
* Client: Fix typo * Client: Add removeFriend feature * Server: Add removeFriend feature * Server: Update method name * Fix rebase onto develop issues * Server: Fix error message * Server: Remove useless methods in removeFriend method * Server: Finish remove on pod feature after rebase * Server: Type pod parameter * Fix Travis build * Add friend-basic test for the remove one pod feature * Add check-params tests for the remove one pod feature * Fix typos * Add friend-advanced test for the remove one pod feature * Client: Trailing new line * Move to promises * Add undefined id test * Use find method instead of a for loop to find the friend to remove * Remove setTimeout method * Server: Remove requestScheduler operations * Server: Fix logging messages * Server: Remove sign request parameter
Diffstat (limited to 'server/tests/api/friends-basic.js')
-rw-r--r--server/tests/api/friends-basic.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/server/tests/api/friends-basic.js b/server/tests/api/friends-basic.js
index 4c2043b39..5f1fdd255 100644
--- a/server/tests/api/friends-basic.js
+++ b/server/tests/api/friends-basic.js
@@ -198,6 +198,71 @@ describe('Test basic friends', function () {
198 }) 198 })
199 }) 199 })
200 200
201 it('Should allow pod 1 to quit only pod 2', function (done) {
202 series([
203 // Pod 1 quits pod 2
204 function (next) {
205 const server = servers[0]
206
207 // Get pod 2 id so we can query it
208 podsUtils.getFriendsList(server.url, function (err, res) {
209 if (err) throw err
210
211 const result = res.body.data
212 let pod = result.find((friend) => (friend.host === servers[1].host))
213
214 // Remove it from the friends list
215 podsUtils.quitOneFriend(server.url, server.accessToken, pod.id, next)
216 })
217 },
218
219 // Pod 1 should have only pod 3 in its friends list
220 function (next) {
221 podsUtils.getFriendsList(servers[0].url, function (err, res) {
222 if (err) throw err
223
224 const result = res.body.data
225 expect(result).to.be.an('array')
226 expect(result.length).to.equal(1)
227
228 const pod = result[0]
229 expect(pod.host).to.equal(servers[2].host)
230
231 next()
232 })
233 },
234
235 // Pod 2 should have only pod 3 in its friends list
236 function (next) {
237 podsUtils.getFriendsList(servers[1].url, function (err, res) {
238 if (err) throw err
239
240 const result = res.body.data
241 expect(result).to.be.an('array')
242 expect(result.length).to.equal(1)
243
244 const pod = result[0]
245 expect(pod.host).to.equal(servers[2].host)
246
247 next()
248 })
249 },
250
251 // Pod 3 should have both pods in its friends list
252 function (next) {
253 podsUtils.getFriendsList(servers[2].url, function (err, res) {
254 if (err) throw err
255
256 const result = res.body.data
257 expect(result).to.be.an('array')
258 expect(result.length).to.equal(2)
259
260 next()
261 })
262 }
263 ], done)
264 })
265
201 after(function (done) { 266 after(function (done) {
202 servers.forEach(function (server) { 267 servers.forEach(function (server) {
203 process.kill(-server.app.pid) 268 process.kill(-server.app.pid)