aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/friendsAdvanced.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-07 22:09:59 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-07 22:09:59 +0200
commit8d30905858245f12a42fc327d2d57cbfe062d548 (patch)
tree9bd590872fbb753782f2ebbb9516db0414022d70 /server/tests/api/friendsAdvanced.js
parent58b2ba55a90f05f24661e664b1fb0a3486f037e8 (diff)
downloadPeerTube-8d30905858245f12a42fc327d2d57cbfe062d548.tar.gz
PeerTube-8d30905858245f12a42fc327d2d57cbfe062d548.tar.zst
PeerTube-8d30905858245f12a42fc327d2d57cbfe062d548.zip
Server: split tests utils in multiple files
Diffstat (limited to 'server/tests/api/friendsAdvanced.js')
-rw-r--r--server/tests/api/friendsAdvanced.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/server/tests/api/friendsAdvanced.js b/server/tests/api/friendsAdvanced.js
index 603fbc16b..0d24481ef 100644
--- a/server/tests/api/friendsAdvanced.js
+++ b/server/tests/api/friendsAdvanced.js
@@ -5,24 +5,27 @@ const each = require('async/each')
5const expect = chai.expect 5const expect = chai.expect
6const series = require('async/series') 6const series = require('async/series')
7 7
8const utils = require('./utils') 8const loginUtils = require('../utils/login')
9const podsUtils = require('../utils/pods')
10const serversUtils = require('../utils/servers')
11const videosUtils = require('../utils/videos')
9 12
10describe('Test advanced friends', function () { 13describe('Test advanced friends', function () {
11 let servers = [] 14 let servers = []
12 15
13 function makeFriends (podNumber, callback) { 16 function makeFriends (podNumber, callback) {
14 const server = servers[podNumber - 1] 17 const server = servers[podNumber - 1]
15 return utils.makeFriends(server.url, server.accessToken, callback) 18 return podsUtils.makeFriends(server.url, server.accessToken, callback)
16 } 19 }
17 20
18 function quitFriends (podNumber, callback) { 21 function quitFriends (podNumber, callback) {
19 const server = servers[podNumber - 1] 22 const server = servers[podNumber - 1]
20 return utils.quitFriends(server.url, server.accessToken, callback) 23 return podsUtils.quitFriends(server.url, server.accessToken, callback)
21 } 24 }
22 25
23 function getFriendsList (podNumber, end) { 26 function getFriendsList (podNumber, end) {
24 const server = servers[podNumber - 1] 27 const server = servers[podNumber - 1]
25 return utils.getFriendsList(server.url, end) 28 return podsUtils.getFriendsList(server.url, end)
26 } 29 }
27 30
28 function uploadVideo (podNumber, callback) { 31 function uploadVideo (podNumber, callback) {
@@ -32,22 +35,22 @@ describe('Test advanced friends', function () {
32 const fixture = 'video_short.webm' 35 const fixture = 'video_short.webm'
33 const server = servers[podNumber - 1] 36 const server = servers[podNumber - 1]
34 37
35 return utils.uploadVideo(server.url, server.accessToken, name, description, tags, fixture, callback) 38 return videosUtils.uploadVideo(server.url, server.accessToken, name, description, tags, fixture, callback)
36 } 39 }
37 40
38 function getVideos (podNumber, callback) { 41 function getVideos (podNumber, callback) {
39 return utils.getVideosList(servers[podNumber - 1].url, callback) 42 return videosUtils.getVideosList(servers[podNumber - 1].url, callback)
40 } 43 }
41 44
42 // --------------------------------------------------------------- 45 // ---------------------------------------------------------------
43 46
44 before(function (done) { 47 before(function (done) {
45 this.timeout(30000) 48 this.timeout(30000)
46 utils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) { 49 serversUtils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) {
47 servers = serversRun 50 servers = serversRun
48 51
49 each(servers, function (server, callbackEach) { 52 each(servers, function (server, callbackEach) {
50 utils.loginAndGetAccessToken(server, function (err, accessToken) { 53 loginUtils.loginAndGetAccessToken(server, function (err, accessToken) {
51 if (err) return callbackEach(err) 54 if (err) return callbackEach(err)
52 55
53 server.accessToken = accessToken 56 server.accessToken = accessToken
@@ -169,7 +172,7 @@ describe('Test advanced friends', function () {
169 }, 172 },
170 // Rerun server 4 173 // Rerun server 4
171 function (next) { 174 function (next) {
172 utils.runServer(4, function (server) { 175 serversUtils.runServer(4, function (server) {
173 servers[3].app = server.app 176 servers[3].app = server.app
174 next() 177 next()
175 }) 178 })
@@ -273,7 +276,7 @@ describe('Test advanced friends', function () {
273 }) 276 })
274 277
275 if (this.ok) { 278 if (this.ok) {
276 utils.flushTests(done) 279 serversUtils.flushTests(done)
277 } else { 280 } else {
278 done() 281 done()
279 } 282 }