aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/api/friendsAdvanced.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-12-06 17:09:07 +0100
committerChocobozzz <florian.bigard@gmail.com>2015-12-07 17:22:36 +0100
commit876d1bcfd07b14d47ba377474e3bb680872d1f7a (patch)
tree4400850a7e4e6b7140ef9cea289784eb21f972b3 /test/api/friendsAdvanced.js
parent4d5f813870683c29af6b9959efa9fd4c4ea5e3b7 (diff)
downloadPeerTube-876d1bcfd07b14d47ba377474e3bb680872d1f7a.tar.gz
PeerTube-876d1bcfd07b14d47ba377474e3bb680872d1f7a.tar.zst
PeerTube-876d1bcfd07b14d47ba377474e3bb680872d1f7a.zip
Tests refractoring
Diffstat (limited to 'test/api/friendsAdvanced.js')
-rw-r--r--test/api/friendsAdvanced.js47
1 files changed, 8 insertions, 39 deletions
diff --git a/test/api/friendsAdvanced.js b/test/api/friendsAdvanced.js
index 680d90aee..7a0940647 100644
--- a/test/api/friendsAdvanced.js
+++ b/test/api/friendsAdvanced.js
@@ -1,60 +1,29 @@
1;(function () { 1;(function () {
2 'use strict' 2 'use strict'
3 3
4 var request = require('supertest')
5 var chai = require('chai') 4 var chai = require('chai')
6 var expect = chai.expect 5 var expect = chai.expect
7 6
8 var utils = require('../utils') 7 var utils = require('./utils')
9 8
10 describe('Test advanced friends', function () { 9 describe('Test advanced friends', function () {
11 var path = '/api/v1/pods/makefriends'
12 var apps = [] 10 var apps = []
13 var urls = [] 11 var urls = []
14 12
15 function makeFriend (pod_number, callback) { 13 function makeFriend (pod_number, callback) {
16 // The first pod make friend with the third 14 return utils.makeFriend(urls[pod_number - 1], callback)
17 request(urls[pod_number - 1])
18 .get(path)
19 .set('Accept', 'application/json')
20 .expect(204)
21 .end(function (err, res) {
22 if (err) throw err
23
24 // Wait for the request between pods
25 setTimeout(function () {
26 callback()
27 }, 1000)
28 })
29 } 15 }
30 16
31 function getFriendsList (pod_number, end) { 17 function getFriendsList (pod_number, end) {
32 var path = '/api/v1/pods/' 18 return utils.getFriendsList(urls[pod_number - 1], end)
33
34 request(urls[pod_number - 1])
35 .get(path)
36 .set('Accept', 'application/json')
37 .expect(200)
38 .expect('Content-Type', /json/)
39 .end(end)
40 } 19 }
41 20
42 function uploadVideo (pod_number, callback) { 21 function uploadVideo (pod_number, callback) {
43 var path = '/api/v1/videos' 22 var name = 'my super video'
44 23 var description = 'my super description'
45 request(urls[pod_number - 1]) 24 var fixture = 'video_short.webm'
46 .post(path) 25
47 .set('Accept', 'application/json') 26 return utils.uploadVideo(urls[pod_number - 1], name, description, fixture, callback)
48 .field('name', 'my super video')
49 .field('description', 'my super description')
50 .attach('input_video', __dirname + '/../fixtures/video_short.webm')
51 .expect(201)
52 .end(function (err) {
53 if (err) throw err
54
55 // Wait for the retry requests
56 setTimeout(callback, 10000)
57 })
58 } 27 }
59 28
60 beforeEach(function (done) { 29 beforeEach(function (done) {