]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/utils/pods.js
3 const request
= require('supertest')
11 // ---------------------- Export functions --------------------
13 function getFriendsList (url
, end
) {
14 const path
= '/api/v1/pods/'
18 .set('Accept', 'application/json')
20 .expect('Content-Type', /json/)
24 function makeFriends (url
, accessToken
, expectedStatus
, end
) {
30 // Which pod makes friends with which pod
31 const friendsMatrix
= {
32 'http://localhost:9001': [
33 'http://localhost:9002'
35 'http://localhost:9002': [
36 'http://localhost:9003'
38 'http://localhost:9003': [
39 'http://localhost:9001'
41 'http://localhost:9004': [
42 'http://localhost:9002'
44 'http://localhost:9005': [
45 'http://localhost:9001',
46 'http://localhost:9004'
48 'http://localhost:9006': [
49 'http://localhost:9001',
50 'http://localhost:9002',
51 'http://localhost:9003'
54 const path
= '/api/v1/pods/makefriends'
56 // The first pod make friend with the third
59 .set('Accept', 'application/json')
60 .set('Authorization', 'Bearer ' + accessToken
)
61 .send({ 'urls': friendsMatrix
[url
] })
62 .expect(expectedStatus
)
63 .end(function (err
, res
) {
66 // Wait for the request between pods
71 function quitFriends (url
, accessToken
, expectedStatus
, end
) {
77 const path
= '/api/v1/pods/quitfriends'
79 // The first pod make friend with the third
82 .set('Accept', 'application/json')
83 .set('Authorization', 'Bearer ' + accessToken
)
84 .expect(expectedStatus
)
85 .end(function (err
, res
) {
88 // Wait for the request between pods
93 // ---------------------------------------------------------------------------
95 module
.exports
= podsUtils