aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/follows.ts222
-rw-r--r--server/tests/api/check-params/index.ts4
-rw-r--r--server/tests/api/check-params/pods.ts287
-rw-r--r--server/tests/api/check-params/remotes.ts54
-rw-r--r--server/tests/api/check-params/request-schedulers.ts65
-rw-r--r--server/tests/api/check-params/videos.ts4
-rw-r--r--server/tests/api/index-fast.ts2
-rw-r--r--server/tests/api/index-slow.ts2
-rw-r--r--server/tests/api/multiple-servers.ts (renamed from server/tests/api/multiple-pods.ts)179
-rw-r--r--server/tests/api/services.ts1
-rw-r--r--server/tests/api/single-server.ts (renamed from server/tests/api/single-pod.ts)2
-rw-r--r--server/tests/api/video-privacy.ts16
12 files changed, 325 insertions, 513 deletions
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
new file mode 100644
index 000000000..d742200c1
--- /dev/null
+++ b/server/tests/api/check-params/follows.ts
@@ -0,0 +1,222 @@
1/* tslint:disable:no-unused-expression */
2
3import * as request from 'supertest'
4import 'mocha'
5
6import {
7 ServerInfo,
8 flushTests,
9 runServer,
10 createUser,
11 loginAndGetAccessToken,
12 setAccessTokensToServers,
13 killallServers,
14 makePostBodyRequest
15} from '../../utils'
16
17describe('Test server follows API validators', function () {
18 let server: ServerInfo
19
20 // ---------------------------------------------------------------
21
22 before(async function () {
23 this.timeout(45000)
24
25 await flushTests()
26 server = await runServer(1)
27
28 await setAccessTokensToServers([ server ])
29 })
30
31 describe('When managing following', function () {
32 let userAccessToken = null
33
34 before(async function () {
35 await createUser(server.url, server.accessToken, 'user1', 'password')
36 server.user = {
37 username: 'user1',
38 password: 'password'
39 }
40
41 userAccessToken = await loginAndGetAccessToken(server)
42 })
43
44 describe('When adding follows', function () {
45 const path = '/api/v1/server/following'
46 const body = {
47 hosts: [ 'localhost:9002' ]
48 }
49
50 it('Should fail without hosts', async function () {
51 await request(server.url)
52 .post(path)
53 .set('Authorization', 'Bearer ' + server.accessToken)
54 .set('Accept', 'application/json')
55 .expect(400)
56 })
57
58 it('Should fail if hosts is not an array', async function () {
59 await request(server.url)
60 .post(path)
61 .send({ hosts: 'localhost:9002' })
62 .set('Authorization', 'Bearer ' + server.accessToken)
63 .set('Accept', 'application/json')
64 .expect(400)
65 })
66
67 it('Should fail if the array is not composed by hosts', async function () {
68 await request(server.url)
69 .post(path)
70 .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] })
71 .set('Authorization', 'Bearer ' + server.accessToken)
72 .set('Accept', 'application/json')
73 .expect(400)
74 })
75
76 it('Should fail if the array is composed with http schemes', async function () {
77 await request(server.url)
78 .post(path)
79 .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] })
80 .set('Authorization', 'Bearer ' + server.accessToken)
81 .set('Accept', 'application/json')
82 .expect(400)
83 })
84
85 it('Should fail if hosts are not unique', async function () {
86 await request(server.url)
87 .post(path)
88 .send({ urls: [ 'localhost:9002', 'localhost:9002' ] })
89 .set('Authorization', 'Bearer ' + server.accessToken)
90 .set('Accept', 'application/json')
91 .expect(400)
92 })
93
94 it('Should fail with an invalid token', async function () {
95 await request(server.url)
96 .post(path)
97 .send(body)
98 .set('Authorization', 'Bearer fake_token')
99 .set('Accept', 'application/json')
100 .expect(401)
101 })
102
103 it('Should fail if the user is not an administrator', async function () {
104 await request(server.url)
105 .post(path)
106 .send(body)
107 .set('Authorization', 'Bearer ' + userAccessToken)
108 .set('Accept', 'application/json')
109 .expect(403)
110 })
111 })
112
113 describe('When listing followings', function () {
114 const path = '/api/v1/server/following'
115
116 it('Should fail with a bad start pagination', async function () {
117 await request(server.url)
118 .get(path)
119 .query({ start: 'hello' })
120 .set('Accept', 'application/json')
121 .expect(400)
122 })
123
124 it('Should fail with a bad count pagination', async function () {
125 await request(server.url)
126 .get(path)
127 .query({ count: 'hello' })
128 .set('Accept', 'application/json')
129 .expect(400)
130 })
131
132 it('Should fail with an incorrect sort', async function () {
133 await request(server.url)
134 .get(path)
135 .query({ sort: 'hello' })
136 .set('Accept', 'application/json')
137 .expect(400)
138 })
139 })
140
141 describe('When listing followers', function () {
142 const path = '/api/v1/server/followers'
143
144 it('Should fail with a bad start pagination', async function () {
145 await request(server.url)
146 .get(path)
147 .query({ start: 'hello' })
148 .set('Accept', 'application/json')
149 .expect(400)
150 })
151
152 it('Should fail with a bad count pagination', async function () {
153 await request(server.url)
154 .get(path)
155 .query({ count: 'hello' })
156 .set('Accept', 'application/json')
157 .expect(400)
158 })
159
160 it('Should fail with an incorrect sort', async function () {
161 await request(server.url)
162 .get(path)
163 .query({ sort: 'hello' })
164 .set('Accept', 'application/json')
165 .expect(400)
166 })
167 })
168
169 describe('When removing following', function () {
170 // it('Should fail with an invalid token', async function () {
171 // await request(server.url)
172 // .delete(path + '/1')
173 // .set('Authorization', 'Bearer faketoken')
174 // .set('Accept', 'application/json')
175 // .expect(401)
176 // })
177 //
178 // it('Should fail if the user is not an administrator', async function () {
179 // await request(server.url)
180 // .delete(path + '/1')
181 // .set('Authorization', 'Bearer ' + userAccessToken)
182 // .set('Accept', 'application/json')
183 // .expect(403)
184 // })
185 //
186 // it('Should fail with an undefined id', async function () {
187 // await request(server.url)
188 // .delete(path + '/' + undefined)
189 // .set('Authorization', 'Bearer ' + server.accessToken)
190 // .set('Accept', 'application/json')
191 // .expect(400)
192 // })
193 //
194 // it('Should fail with an invalid id', async function () {
195 // await request(server.url)
196 // .delete(path + '/foobar')
197 // .set('Authorization', 'Bearer ' + server.accessToken)
198 // .set('Accept', 'application/json')
199 // .expect(400)
200 // })
201 //
202 // it('Should fail we do not follow this server', async function () {
203 // await request(server.url)
204 // .delete(path + '/-1')
205 // .set('Authorization', 'Bearer ' + server.accessToken)
206 // .set('Accept', 'application/json')
207 // .expect(404)
208 // })
209 //
210 // it('Should succeed with the correct parameters')
211 })
212 })
213
214 after(async function () {
215 killallServers([ server ])
216
217 // Keep the logs if the test failed
218 if (this['ok']) {
219 await flushTests()
220 }
221 })
222})
diff --git a/server/tests/api/check-params/index.ts b/server/tests/api/check-params/index.ts
index 954b206e9..287480808 100644
--- a/server/tests/api/check-params/index.ts
+++ b/server/tests/api/check-params/index.ts
@@ -1,8 +1,6 @@
1// Order of the tests we want to execute 1// Order of the tests we want to execute
2import './pods' 2import './follows'
3import './remotes'
4import './users' 3import './users'
5import './request-schedulers'
6import './services' 4import './services'
7import './videos' 5import './videos'
8import './video-abuses' 6import './video-abuses'
diff --git a/server/tests/api/check-params/pods.ts b/server/tests/api/check-params/pods.ts
deleted file mode 100644
index 9f9c2e4f0..000000000
--- a/server/tests/api/check-params/pods.ts
+++ /dev/null
@@ -1,287 +0,0 @@
1/* tslint:disable:no-unused-expression */
2
3import * as request from 'supertest'
4import 'mocha'
5
6import {
7 ServerInfo,
8 flushTests,
9 runServer,
10 createUser,
11 loginAndGetAccessToken,
12 setAccessTokensToServers,
13 killallServers,
14 makePostBodyRequest
15} from '../../utils'
16
17describe('Test pods API validators', function () {
18 let server: ServerInfo
19
20 // ---------------------------------------------------------------
21
22 before(async function () {
23 this.timeout(45000)
24
25 await flushTests()
26 server = await runServer(1)
27
28 await setAccessTokensToServers([ server ])
29 })
30
31 describe('When managing friends', function () {
32 const path = '/api/v1/pods/'
33 let userAccessToken = null
34
35 before(async function () {
36 await createUser(server.url, server.accessToken, 'user1', 'password')
37 server.user = {
38 username: 'user1',
39 password: 'password'
40 }
41
42 userAccessToken = await loginAndGetAccessToken(server)
43 })
44
45 describe('When making friends', function () {
46 const body = {
47 hosts: [ 'localhost:9002' ]
48 }
49
50 it('Should fail without hosts', async function () {
51 await request(server.url)
52 .post(path + '/make-friends')
53 .set('Authorization', 'Bearer ' + server.accessToken)
54 .set('Accept', 'application/json')
55 .expect(400)
56 })
57
58 it('Should fail if hosts is not an array', async function () {
59 await request(server.url)
60 .post(path + '/make-friends')
61 .send({ hosts: 'localhost:9002' })
62 .set('Authorization', 'Bearer ' + server.accessToken)
63 .set('Accept', 'application/json')
64 .expect(400)
65 })
66
67 it('Should fail if the array is not composed by hosts', async function () {
68 await request(server.url)
69 .post(path + '/make-friends')
70 .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] })
71 .set('Authorization', 'Bearer ' + server.accessToken)
72 .set('Accept', 'application/json')
73 .expect(400)
74 })
75
76 it('Should fail if the array is composed with http schemes', async function () {
77 await request(server.url)
78 .post(path + '/make-friends')
79 .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] })
80 .set('Authorization', 'Bearer ' + server.accessToken)
81 .set('Accept', 'application/json')
82 .expect(400)
83 })
84
85 it('Should fail if hosts are not unique', async function () {
86 await request(server.url)
87 .post(path + '/make-friends')
88 .send({ urls: [ 'localhost:9002', 'localhost:9002' ] })
89 .set('Authorization', 'Bearer ' + server.accessToken)
90 .set('Accept', 'application/json')
91 .expect(400)
92 })
93
94 it('Should fail with an invalid token', async function () {
95 await request(server.url)
96 .post(path + '/make-friends')
97 .send(body)
98 .set('Authorization', 'Bearer fake_token')
99 .set('Accept', 'application/json')
100 .expect(401)
101 })
102
103 it('Should fail if the user is not an administrator', async function () {
104 await request(server.url)
105 .post(path + '/make-friends')
106 .send(body)
107 .set('Authorization', 'Bearer ' + userAccessToken)
108 .set('Accept', 'application/json')
109 .expect(403)
110 })
111 })
112
113 describe('When listing friends', function () {
114 it('Should fail with a bad start pagination', async function () {
115 await request(server.url)
116 .get(path)
117 .query({ start: 'hello' })
118 .set('Accept', 'application/json')
119 .expect(400)
120 })
121
122 it('Should fail with a bad count pagination', async function () {
123 await request(server.url)
124 .get(path)
125 .query({ count: 'hello' })
126 .set('Accept', 'application/json')
127 .expect(400)
128 })
129
130 it('Should fail with an incorrect sort', async function () {
131 await request(server.url)
132 .get(path)
133 .query({ sort: 'hello' })
134 .set('Accept', 'application/json')
135 .expect(400)
136 })
137 })
138
139 describe('When quitting friends', function () {
140 it('Should fail with an invalid token', async function () {
141 await request(server.url)
142 .get(path + '/quit-friends')
143 .query({ start: 'hello' })
144 .set('Authorization', 'Bearer faketoken')
145 .set('Accept', 'application/json')
146 .expect(401)
147 })
148
149 it('Should fail if the user is not an administrator', async function () {
150 await request(server.url)
151 .get(path + '/quit-friends')
152 .query({ start: 'hello' })
153 .set('Authorization', 'Bearer ' + userAccessToken)
154 .set('Accept', 'application/json')
155 .expect(403)
156 })
157 })
158
159 describe('When removing one friend', function () {
160 it('Should fail with an invalid token', async function () {
161 await request(server.url)
162 .delete(path + '/1')
163 .set('Authorization', 'Bearer faketoken')
164 .set('Accept', 'application/json')
165 .expect(401)
166 })
167
168 it('Should fail if the user is not an administrator', async function () {
169 await request(server.url)
170 .delete(path + '/1')
171 .set('Authorization', 'Bearer ' + userAccessToken)
172 .set('Accept', 'application/json')
173 .expect(403)
174 })
175
176 it('Should fail with an undefined id', async function () {
177 await request(server.url)
178 .delete(path + '/' + undefined)
179 .set('Authorization', 'Bearer ' + server.accessToken)
180 .set('Accept', 'application/json')
181 .expect(400)
182 })
183
184 it('Should fail with an invalid id', async function () {
185 await request(server.url)
186 .delete(path + '/foobar')
187 .set('Authorization', 'Bearer ' + server.accessToken)
188 .set('Accept', 'application/json')
189 .expect(400)
190 })
191
192 it('Should fail if the pod is not a friend', async function () {
193 await request(server.url)
194 .delete(path + '/-1')
195 .set('Authorization', 'Bearer ' + server.accessToken)
196 .set('Accept', 'application/json')
197 .expect(404)
198 })
199
200 it('Should succeed with the correct parameters')
201 })
202 })
203
204 describe('When adding a pod from remote', function () {
205 const path = '/api/v1/remote/pods/add'
206
207 it('Should fail with nothing', async function () {
208 const fields = {}
209 await makePostBodyRequest({ url: server.url, path, fields })
210 })
211
212 it('Should fail without public key', async function () {
213 const fields = {
214 email: 'test.example.com',
215 host: 'coucou.com'
216 }
217 await makePostBodyRequest({ url: server.url, path, fields })
218 })
219
220 it('Should fail without an email', async function () {
221 const fields = {
222 host: 'coucou.com',
223 publicKey: 'my super public key'
224 }
225 await makePostBodyRequest({ url: server.url, path, fields })
226 })
227
228 it('Should fail without an invalid email', async function () {
229 const fields = {
230 host: 'coucou.com',
231 email: 'test.example.com',
232 publicKey: 'my super public key'
233 }
234 await makePostBodyRequest({ url: server.url, path, fields })
235 })
236
237 it('Should fail without a host', async function () {
238 const fields = {
239 email: 'test.example.com',
240 publicKey: 'my super public key'
241 }
242 await makePostBodyRequest({ url: server.url, path, fields })
243 })
244
245 it('Should fail with an incorrect host', async function () {
246 const fields = {
247 host: 'http://coucou.com',
248 email: 'test.example.com',
249 publicKey: 'my super public key'
250 }
251 await makePostBodyRequest({ url: server.url, path, fields })
252
253 fields.host = 'http://coucou'
254 await makePostBodyRequest({ url: server.url, path, fields })
255
256 fields.host = 'coucou'
257 await makePostBodyRequest({ url: server.url, path, fields })
258 })
259
260 it('Should succeed with the correct parameters', async function () {
261 const fields = {
262 host: 'coucou.com',
263 email: 'test@example.com',
264 publicKey: 'my super public key'
265 }
266 await makePostBodyRequest({ url: server.url, path, fields, statusCodeExpected: 200 })
267 })
268
269 it('Should fail with a host that already exists', async function () {
270 const fields = {
271 host: 'coucou.com',
272 email: 'test@example.com',
273 publicKey: 'my super public key'
274 }
275 await makePostBodyRequest({ url: server.url, path, fields, statusCodeExpected: 409 })
276 })
277 })
278
279 after(async function () {
280 killallServers([ server ])
281
282 // Keep the logs if the test failed
283 if (this['ok']) {
284 await flushTests()
285 }
286 })
287})
diff --git a/server/tests/api/check-params/remotes.ts b/server/tests/api/check-params/remotes.ts
deleted file mode 100644
index 6d1747442..000000000
--- a/server/tests/api/check-params/remotes.ts
+++ /dev/null
@@ -1,54 +0,0 @@
1/* tslint:disable:no-unused-expression */
2
3import 'mocha'
4
5import {
6 ServerInfo,
7 flushTests,
8 runServer,
9 setAccessTokensToServers,
10 killallServers
11} from '../../utils'
12
13describe('Test remote videos API validators', function () {
14 let server: ServerInfo
15
16 // ---------------------------------------------------------------
17
18 before(async function () {
19 this.timeout(60000)
20
21 await flushTests()
22
23 server = await runServer(1)
24
25 await setAccessTokensToServers([ server ])
26 })
27
28 describe('When making a secure request', async function () {
29 it('Should check a secure request')
30 })
31
32 describe('When adding a video', async function () {
33 it('Should check when adding a video')
34
35 it('Should not add an existing uuid')
36 })
37
38 describe('When removing a video', async function () {
39 it('Should check when removing a video')
40 })
41
42 describe('When reporting abuse on a video', async function () {
43 it('Should check when reporting a video abuse')
44 })
45
46 after(async function () {
47 killallServers([ server ])
48
49 // Keep the logs if the test failed
50 if (this['ok']) {
51 await flushTests()
52 }
53 })
54})
diff --git a/server/tests/api/check-params/request-schedulers.ts b/server/tests/api/check-params/request-schedulers.ts
deleted file mode 100644
index 01a54ffa1..000000000
--- a/server/tests/api/check-params/request-schedulers.ts
+++ /dev/null
@@ -1,65 +0,0 @@
1/* tslint:disable:no-unused-expression */
2
3import * as request from 'supertest'
4import 'mocha'
5
6import {
7 flushTests,
8 runServer,
9 createUser,
10 setAccessTokensToServers,
11 killallServers,
12 getUserAccessToken
13} from '../../utils'
14
15describe('Test request schedulers stats API validators', function () {
16 const path = '/api/v1/request-schedulers/stats'
17 let server = null
18 let userAccessToken = null
19
20 // ---------------------------------------------------------------
21
22 before(async function () {
23 this.timeout(60000)
24
25 await flushTests()
26
27 server = await runServer(1)
28 await setAccessTokensToServers([ server ])
29
30 const username = 'user'
31 const password = 'my super password'
32 await createUser(server.url, server.accessToken, username, password)
33
34 const user = {
35 username: 'user',
36 password: 'my super password'
37 }
38
39 userAccessToken = await getUserAccessToken(server, user)
40 })
41
42 it('Should fail with an non authenticated user', async function () {
43 await request(server.url)
44 .get(path)
45 .set('Accept', 'application/json')
46 .expect(401)
47 })
48
49 it('Should fail with a non admin user', async function () {
50 await request(server.url)
51 .get(path)
52 .set('Authorization', 'Bearer ' + userAccessToken)
53 .set('Accept', 'application/json')
54 .expect(403)
55 })
56
57 after(async function () {
58 killallServers([ server ])
59
60 // Keep the logs if the test failed
61 if (this['ok']) {
62 await flushTests()
63 }
64 })
65})
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 5860e9195..7f5609784 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -473,7 +473,7 @@ describe('Test videos API validator', function () {
473 473
474 it('Should fail with a video of another user') 474 it('Should fail with a video of another user')
475 475
476 it('Should fail with a video of another pod') 476 it('Should fail with a video of another server')
477 477
478 it('Should succeed with the correct parameters', async function () { 478 it('Should succeed with the correct parameters', async function () {
479 const fields = getCompleteVideoUpdateAttributes() 479 const fields = getCompleteVideoUpdateAttributes()
@@ -584,7 +584,7 @@ describe('Test videos API validator', function () {
584 584
585 it('Should fail with a video of another user') 585 it('Should fail with a video of another user')
586 586
587 it('Should fail with a video of another pod') 587 it('Should fail with a video of another server')
588 588
589 it('Should succeed with the correct parameters') 589 it('Should succeed with the correct parameters')
590 }) 590 })
diff --git a/server/tests/api/index-fast.ts b/server/tests/api/index-fast.ts
index 590b0d51c..35b414383 100644
--- a/server/tests/api/index-fast.ts
+++ b/server/tests/api/index-fast.ts
@@ -2,7 +2,7 @@
2import './config' 2import './config'
3import './check-params' 3import './check-params'
4import './users' 4import './users'
5import './single-pod' 5import './single-server'
6import './video-abuse' 6import './video-abuse'
7import './video-blacklist' 7import './video-blacklist'
8import './video-blacklist-management' 8import './video-blacklist-management'
diff --git a/server/tests/api/index-slow.ts b/server/tests/api/index-slow.ts
index a2faf8d0f..e554c25f8 100644
--- a/server/tests/api/index-slow.ts
+++ b/server/tests/api/index-slow.ts
@@ -1,3 +1,3 @@
1// Order of the tests we want to execute 1// Order of the tests we want to execute
2import './multiple-pods' 2import './multiple-servers'
3import './video-transcoder' 3import './video-transcoder'
diff --git a/server/tests/api/multiple-pods.ts b/server/tests/api/multiple-servers.ts
index 3c6b3f650..737770992 100644
--- a/server/tests/api/multiple-pods.ts
+++ b/server/tests/api/multiple-servers.ts
@@ -10,7 +10,6 @@ import {
10 getVideo, 10 getVideo,
11 getVideosList, 11 getVideosList,
12 killallServers, 12 killallServers,
13 makeFriends,
14 rateVideo, 13 rateVideo,
15 removeVideo, 14 removeVideo,
16 ServerInfo, 15 ServerInfo,
@@ -22,13 +21,14 @@ import {
22 webtorrentAdd, 21 webtorrentAdd,
23 addVideoChannel, 22 addVideoChannel,
24 getVideoChannelsList, 23 getVideoChannelsList,
25 getUserAccessToken 24 getUserAccessToken,
25 doubleFollow
26} from '../utils' 26} from '../utils'
27import { createUser } from '../utils/users' 27import { createUser } from '../utils/users'
28 28
29const expect = chai.expect 29const expect = chai.expect
30 30
31describe('Test multiple pods', function () { 31describe('Test multiple servers', function () {
32 let servers: ServerInfo[] = [] 32 let servers: ServerInfo[] = []
33 const toRemove = [] 33 const toRemove = []
34 let videoUUID = '' 34 let videoUUID = ''
@@ -50,17 +50,15 @@ describe('Test multiple pods', function () {
50 const channelRes = await getVideoChannelsList(servers[0].url, 0, 1) 50 const channelRes = await getVideoChannelsList(servers[0].url, 0, 1)
51 videoChannelId = channelRes.body.data[0].id 51 videoChannelId = channelRes.body.data[0].id
52 52
53 // The second pod make friend with the third 53 // Server 1 and server 2 follow each other
54 await makeFriends(servers[1].url, servers[1].accessToken) 54 await doubleFollow(servers[0], servers[1])
55 55 // Server 1 and server 3 follow each other
56 // Wait for the request between pods 56 await doubleFollow(servers[0], servers[2])
57 await wait(10000) 57 // Server 2 and server 3 follow each other
58 58 await doubleFollow(servers[1], servers[2])
59 // Pod 1 make friends too
60 await makeFriends(servers[0].url, servers[0].accessToken)
61 }) 59 })
62 60
63 it('Should not have videos for all pods', async function () { 61 it('Should not have videos for all servers', async function () {
64 for (const server of servers) { 62 for (const server of servers) {
65 const res = await getVideosList(server.url) 63 const res = await getVideosList(server.url)
66 const videos = res.body.data 64 const videos = res.body.data
@@ -69,18 +67,18 @@ describe('Test multiple pods', function () {
69 } 67 }
70 }) 68 })
71 69
72 describe('Should upload the video and propagate on each pod', function () { 70 describe('Should upload the video and propagate on each server', function () {
73 it('Should upload the video on pod 1 and propagate on each pod', async function () { 71 it('Should upload the video on server 1 and propagate on each server', async function () {
74 // Pod 1 has video transcoding activated 72 // Server 1 has video transcoding activated
75 this.timeout(15000) 73 this.timeout(15000)
76 74
77 const videoAttributes = { 75 const videoAttributes = {
78 name: 'my super name for pod 1', 76 name: 'my super name for server 1',
79 category: 5, 77 category: 5,
80 licence: 4, 78 licence: 4,
81 language: 9, 79 language: 9,
82 nsfw: true, 80 nsfw: true,
83 description: 'my super description for pod 1', 81 description: 'my super description for server 1',
84 tags: [ 'tag1p1', 'tag2p1' ], 82 tags: [ 'tag1p1', 'tag2p1' ],
85 channelId: videoChannelId, 83 channelId: videoChannelId,
86 fixture: 'video_short1.webm' 84 fixture: 'video_short1.webm'
@@ -89,7 +87,7 @@ describe('Test multiple pods', function () {
89 87
90 await wait(11000) 88 await wait(11000)
91 89
92 // All pods should have this video 90 // All servers should have this video
93 for (const server of servers) { 91 for (const server of servers) {
94 let baseMagnet = null 92 let baseMagnet = null
95 93
@@ -99,7 +97,7 @@ describe('Test multiple pods', function () {
99 expect(videos).to.be.an('array') 97 expect(videos).to.be.an('array')
100 expect(videos.length).to.equal(1) 98 expect(videos.length).to.equal(1)
101 const video = videos[0] 99 const video = videos[0]
102 expect(video.name).to.equal('my super name for pod 1') 100 expect(video.name).to.equal('my super name for server 1')
103 expect(video.category).to.equal(5) 101 expect(video.category).to.equal(5)
104 expect(video.categoryLabel).to.equal('Sports') 102 expect(video.categoryLabel).to.equal('Sports')
105 expect(video.licence).to.equal(4) 103 expect(video.licence).to.equal(4)
@@ -107,8 +105,8 @@ describe('Test multiple pods', function () {
107 expect(video.language).to.equal(9) 105 expect(video.language).to.equal(9)
108 expect(video.languageLabel).to.equal('Japanese') 106 expect(video.languageLabel).to.equal('Japanese')
109 expect(video.nsfw).to.be.ok 107 expect(video.nsfw).to.be.ok
110 expect(video.description).to.equal('my super description for pod 1') 108 expect(video.description).to.equal('my super description for server 1')
111 expect(video.podHost).to.equal('localhost:9001') 109 expect(video.serverHost).to.equal('localhost:9001')
112 expect(video.duration).to.equal(10) 110 expect(video.duration).to.equal(10)
113 expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ]) 111 expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
114 expect(dateIsValid(video.createdAt)).to.be.true 112 expect(dateIsValid(video.createdAt)).to.be.true
@@ -127,8 +125,9 @@ describe('Test multiple pods', function () {
127 const file = videoDetails.files[0] 125 const file = videoDetails.files[0]
128 const magnetUri = file.magnetUri 126 const magnetUri = file.magnetUri
129 expect(file.magnetUri).to.have.lengthOf.above(2) 127 expect(file.magnetUri).to.have.lengthOf.above(2)
130 expect(file.torrentUrl).to.equal(`http://${videoDetails.podHost}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`) 128 expect(file.torrentUrl).to
131 expect(file.fileUrl).to.equal(`http://${videoDetails.podHost}/static/webseed/${videoDetails.uuid}-${file.resolution}.webm`) 129 .equal(`http://${videoDetails.serverHost}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
130 expect(file.fileUrl).to.equal(`http://${videoDetails.serverHost}/static/webseed/${videoDetails.uuid}-${file.resolution}.webm`)
132 expect(file.resolution).to.equal(720) 131 expect(file.resolution).to.equal(720)
133 expect(file.resolutionLabel).to.equal('720p') 132 expect(file.resolutionLabel).to.equal('720p')
134 expect(file.size).to.equal(572456) 133 expect(file.size).to.equal(572456)
@@ -141,7 +140,7 @@ describe('Test multiple pods', function () {
141 expect(videoDetails.channel.isLocal).to.be.true 140 expect(videoDetails.channel.isLocal).to.be.true
142 } 141 }
143 142
144 // All pods should have the same magnet Uri 143 // All servers should have the same magnet Uri
145 if (baseMagnet === null) { 144 if (baseMagnet === null) {
146 baseMagnet = magnetUri 145 baseMagnet = magnetUri
147 } else { 146 } else {
@@ -153,7 +152,7 @@ describe('Test multiple pods', function () {
153 } 152 }
154 }) 153 })
155 154
156 it('Should upload the video on pod 2 and propagate on each pod', async function () { 155 it('Should upload the video on server 2 and propagate on each server', async function () {
157 this.timeout(120000) 156 this.timeout(120000)
158 157
159 const user = { 158 const user = {
@@ -164,12 +163,12 @@ describe('Test multiple pods', function () {
164 const userAccessToken = await getUserAccessToken(servers[1], user) 163 const userAccessToken = await getUserAccessToken(servers[1], user)
165 164
166 const videoAttributes = { 165 const videoAttributes = {
167 name: 'my super name for pod 2', 166 name: 'my super name for server 2',
168 category: 4, 167 category: 4,
169 licence: 3, 168 licence: 3,
170 language: 11, 169 language: 11,
171 nsfw: true, 170 nsfw: true,
172 description: 'my super description for pod 2', 171 description: 'my super description for server 2',
173 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], 172 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
174 fixture: 'video_short2.webm' 173 fixture: 'video_short2.webm'
175 } 174 }
@@ -178,7 +177,7 @@ describe('Test multiple pods', function () {
178 // Transcoding, so wait more than 22000 177 // Transcoding, so wait more than 22000
179 await wait(60000) 178 await wait(60000)
180 179
181 // All pods should have this video 180 // All servers should have this video
182 for (const server of servers) { 181 for (const server of servers) {
183 let baseMagnet = {} 182 let baseMagnet = {}
184 183
@@ -188,7 +187,7 @@ describe('Test multiple pods', function () {
188 expect(videos).to.be.an('array') 187 expect(videos).to.be.an('array')
189 expect(videos.length).to.equal(2) 188 expect(videos.length).to.equal(2)
190 const video = videos[1] 189 const video = videos[1]
191 expect(video.name).to.equal('my super name for pod 2') 190 expect(video.name).to.equal('my super name for server 2')
192 expect(video.category).to.equal(4) 191 expect(video.category).to.equal(4)
193 expect(video.categoryLabel).to.equal('Art') 192 expect(video.categoryLabel).to.equal('Art')
194 expect(video.licence).to.equal(3) 193 expect(video.licence).to.equal(3)
@@ -196,8 +195,8 @@ describe('Test multiple pods', function () {
196 expect(video.language).to.equal(11) 195 expect(video.language).to.equal(11)
197 expect(video.languageLabel).to.equal('German') 196 expect(video.languageLabel).to.equal('German')
198 expect(video.nsfw).to.be.true 197 expect(video.nsfw).to.be.true
199 expect(video.description).to.equal('my super description for pod 2') 198 expect(video.description).to.equal('my super description for server 2')
200 expect(video.podHost).to.equal('localhost:9002') 199 expect(video.serverHost).to.equal('localhost:9002')
201 expect(video.duration).to.equal(5) 200 expect(video.duration).to.equal(5)
202 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) 201 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
203 expect(dateIsValid(video.createdAt)).to.be.true 202 expect(dateIsValid(video.createdAt)).to.be.true
@@ -223,7 +222,7 @@ describe('Test multiple pods', function () {
223 for (const file of videoDetails.files) { 222 for (const file of videoDetails.files) {
224 expect(file.magnetUri).to.have.lengthOf.above(2) 223 expect(file.magnetUri).to.have.lengthOf.above(2)
225 224
226 // All pods should have the same magnet Uri 225 // All servers should have the same magnet Uri
227 if (baseMagnet[file.resolution] === undefined) { 226 if (baseMagnet[file.resolution] === undefined) {
228 baseMagnet[file.resolution] = file.magnet 227 baseMagnet[file.resolution] = file.magnet
229 } else { 228 } else {
@@ -256,28 +255,28 @@ describe('Test multiple pods', function () {
256 } 255 }
257 }) 256 })
258 257
259 it('Should upload two videos on pod 3 and propagate on each pod', async function () { 258 it('Should upload two videos on server 3 and propagate on each server', async function () {
260 this.timeout(45000) 259 this.timeout(45000)
261 260
262 const videoAttributes1 = { 261 const videoAttributes1 = {
263 name: 'my super name for pod 3', 262 name: 'my super name for server 3',
264 category: 6, 263 category: 6,
265 licence: 5, 264 licence: 5,
266 language: 11, 265 language: 11,
267 nsfw: true, 266 nsfw: true,
268 description: 'my super description for pod 3', 267 description: 'my super description for server 3',
269 tags: [ 'tag1p3' ], 268 tags: [ 'tag1p3' ],
270 fixture: 'video_short3.webm' 269 fixture: 'video_short3.webm'
271 } 270 }
272 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes1) 271 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes1)
273 272
274 const videoAttributes2 = { 273 const videoAttributes2 = {
275 name: 'my super name for pod 3-2', 274 name: 'my super name for server 3-2',
276 category: 7, 275 category: 7,
277 licence: 6, 276 licence: 6,
278 language: 12, 277 language: 12,
279 nsfw: false, 278 nsfw: false,
280 description: 'my super description for pod 3-2', 279 description: 'my super description for server 3-2',
281 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], 280 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
282 fixture: 'video_short.webm' 281 fixture: 'video_short.webm'
283 } 282 }
@@ -286,7 +285,7 @@ describe('Test multiple pods', function () {
286 await wait(33000) 285 await wait(33000)
287 286
288 let baseMagnet = null 287 let baseMagnet = null
289 // All pods should have this video 288 // All servers should have this video
290 for (const server of servers) { 289 for (const server of servers) {
291 const res = await getVideosList(server.url) 290 const res = await getVideosList(server.url)
292 291
@@ -297,7 +296,7 @@ describe('Test multiple pods', function () {
297 // We not sure about the order of the two last uploads 296 // We not sure about the order of the two last uploads
298 let video1 = null 297 let video1 = null
299 let video2 = null 298 let video2 = null
300 if (videos[2].name === 'my super name for pod 3') { 299 if (videos[2].name === 'my super name for server 3') {
301 video1 = videos[2] 300 video1 = videos[2]
302 video2 = videos[3] 301 video2 = videos[3]
303 } else { 302 } else {
@@ -305,7 +304,7 @@ describe('Test multiple pods', function () {
305 video2 = videos[2] 304 video2 = videos[2]
306 } 305 }
307 306
308 expect(video1.name).to.equal('my super name for pod 3') 307 expect(video1.name).to.equal('my super name for server 3')
309 expect(video1.category).to.equal(6) 308 expect(video1.category).to.equal(6)
310 expect(video1.categoryLabel).to.equal('Travels') 309 expect(video1.categoryLabel).to.equal('Travels')
311 expect(video1.licence).to.equal(5) 310 expect(video1.licence).to.equal(5)
@@ -313,8 +312,8 @@ describe('Test multiple pods', function () {
313 expect(video1.language).to.equal(11) 312 expect(video1.language).to.equal(11)
314 expect(video1.languageLabel).to.equal('German') 313 expect(video1.languageLabel).to.equal('German')
315 expect(video1.nsfw).to.be.ok 314 expect(video1.nsfw).to.be.ok
316 expect(video1.description).to.equal('my super description for pod 3') 315 expect(video1.description).to.equal('my super description for server 3')
317 expect(video1.podHost).to.equal('localhost:9003') 316 expect(video1.serverHost).to.equal('localhost:9003')
318 expect(video1.duration).to.equal(5) 317 expect(video1.duration).to.equal(5)
319 expect(video1.tags).to.deep.equal([ 'tag1p3' ]) 318 expect(video1.tags).to.deep.equal([ 'tag1p3' ])
320 expect(video1.author).to.equal('root') 319 expect(video1.author).to.equal('root')
@@ -331,7 +330,7 @@ describe('Test multiple pods', function () {
331 expect(file1.resolutionLabel).to.equal('720p') 330 expect(file1.resolutionLabel).to.equal('720p')
332 expect(file1.size).to.equal(292677) 331 expect(file1.size).to.equal(292677)
333 332
334 expect(video2.name).to.equal('my super name for pod 3-2') 333 expect(video2.name).to.equal('my super name for server 3-2')
335 expect(video2.category).to.equal(7) 334 expect(video2.category).to.equal(7)
336 expect(video2.categoryLabel).to.equal('Gaming') 335 expect(video2.categoryLabel).to.equal('Gaming')
337 expect(video2.licence).to.equal(6) 336 expect(video2.licence).to.equal(6)
@@ -339,8 +338,8 @@ describe('Test multiple pods', function () {
339 expect(video2.language).to.equal(12) 338 expect(video2.language).to.equal(12)
340 expect(video2.languageLabel).to.equal('Korean') 339 expect(video2.languageLabel).to.equal('Korean')
341 expect(video2.nsfw).to.be.false 340 expect(video2.nsfw).to.be.false
342 expect(video2.description).to.equal('my super description for pod 3-2') 341 expect(video2.description).to.equal('my super description for server 3-2')
343 expect(video2.podHost).to.equal('localhost:9003') 342 expect(video2.serverHost).to.equal('localhost:9003')
344 expect(video2.duration).to.equal(5) 343 expect(video2.duration).to.equal(5)
345 expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ]) 344 expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
346 expect(video2.author).to.equal('root') 345 expect(video2.author).to.equal('root')
@@ -367,7 +366,7 @@ describe('Test multiple pods', function () {
367 expect(video2.isLocal).to.be.true 366 expect(video2.isLocal).to.be.true
368 } 367 }
369 368
370 // All pods should have the same magnet Uri 369 // All servers should have the same magnet Uri
371 if (baseMagnet === null) { 370 if (baseMagnet === null) {
372 baseMagnet = magnetUri2 371 baseMagnet = magnetUri2
373 } else { 372 } else {
@@ -384,7 +383,7 @@ describe('Test multiple pods', function () {
384 }) 383 })
385 384
386 describe('Should seed the uploaded video', function () { 385 describe('Should seed the uploaded video', function () {
387 it('Should add the file 1 by asking pod 3', async function () { 386 it('Should add the file 1 by asking server 3', async function () {
388 // Yes, this could be long 387 // Yes, this could be long
389 this.timeout(200000) 388 this.timeout(200000)
390 389
@@ -403,7 +402,7 @@ describe('Test multiple pods', function () {
403 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 402 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
404 }) 403 })
405 404
406 it('Should add the file 2 by asking pod 1', async function () { 405 it('Should add the file 2 by asking server 1', async function () {
407 // Yes, this could be long 406 // Yes, this could be long
408 this.timeout(200000) 407 this.timeout(200000)
409 408
@@ -419,7 +418,7 @@ describe('Test multiple pods', function () {
419 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 418 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
420 }) 419 })
421 420
422 it('Should add the file 3 by asking pod 2', async function () { 421 it('Should add the file 3 by asking server 2', async function () {
423 // Yes, this could be long 422 // Yes, this could be long
424 this.timeout(200000) 423 this.timeout(200000)
425 424
@@ -435,7 +434,7 @@ describe('Test multiple pods', function () {
435 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 434 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
436 }) 435 })
437 436
438 it('Should add the file 3-2 by asking pod 1', async function () { 437 it('Should add the file 3-2 by asking server 1', async function () {
439 // Yes, this could be long 438 // Yes, this could be long
440 this.timeout(200000) 439 this.timeout(200000)
441 440
@@ -451,13 +450,13 @@ describe('Test multiple pods', function () {
451 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 450 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
452 }) 451 })
453 452
454 it('Should add the file 2 in 360p by asking pod 1', async function () { 453 it('Should add the file 2 in 360p by asking server 1', async function () {
455 // Yes, this could be long 454 // Yes, this could be long
456 this.timeout(200000) 455 this.timeout(200000)
457 456
458 const res = await getVideosList(servers[0].url) 457 const res = await getVideosList(servers[0].url)
459 458
460 const video = res.body.data.find(v => v.name === 'my super name for pod 2') 459 const video = res.body.data.find(v => v.name === 'my super name for server 2')
461 const res2 = await getVideo(servers[0].url, video.id) 460 const res2 = await getVideo(servers[0].url, video.id)
462 const videoDetails = res2.body 461 const videoDetails = res2.body
463 462
@@ -472,31 +471,31 @@ describe('Test multiple pods', function () {
472 }) 471 })
473 472
474 describe('Should update video views, likes and dislikes', function () { 473 describe('Should update video views, likes and dislikes', function () {
475 let localVideosPod3 = [] 474 let localVideosServer3 = []
476 let remoteVideosPod1 = [] 475 let remoteVideosServer1 = []
477 let remoteVideosPod2 = [] 476 let remoteVideosServer2 = []
478 let remoteVideosPod3 = [] 477 let remoteVideosServer3 = []
479 478
480 before(async function () { 479 before(async function () {
481 const res1 = await getVideosList(servers[0].url) 480 const res1 = await getVideosList(servers[0].url)
482 remoteVideosPod1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.uuid) 481 remoteVideosServer1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
483 482
484 const res2 = await getVideosList(servers[1].url) 483 const res2 = await getVideosList(servers[1].url)
485 remoteVideosPod2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.uuid) 484 remoteVideosServer2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
486 485
487 const res3 = await getVideosList(servers[2].url) 486 const res3 = await getVideosList(servers[2].url)
488 localVideosPod3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.uuid) 487 localVideosServer3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.uuid)
489 remoteVideosPod3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.uuid) 488 remoteVideosServer3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
490 }) 489 })
491 490
492 it('Should view multiple videos on owned servers', async function () { 491 it('Should view multiple videos on owned servers', async function () {
493 this.timeout(30000) 492 this.timeout(30000)
494 493
495 const tasks: Promise<any>[] = [] 494 const tasks: Promise<any>[] = []
496 tasks.push(getVideo(servers[2].url, localVideosPod3[0])) 495 tasks.push(getVideo(servers[2].url, localVideosServer3[0]))
497 tasks.push(getVideo(servers[2].url, localVideosPod3[0])) 496 tasks.push(getVideo(servers[2].url, localVideosServer3[0]))
498 tasks.push(getVideo(servers[2].url, localVideosPod3[0])) 497 tasks.push(getVideo(servers[2].url, localVideosServer3[0]))
499 tasks.push(getVideo(servers[2].url, localVideosPod3[1])) 498 tasks.push(getVideo(servers[2].url, localVideosServer3[1]))
500 499
501 await Promise.all(tasks) 500 await Promise.all(tasks)
502 501
@@ -506,8 +505,8 @@ describe('Test multiple pods', function () {
506 const res = await getVideosList(server.url) 505 const res = await getVideosList(server.url)
507 506
508 const videos = res.body.data 507 const videos = res.body.data
509 const video0 = videos.find(v => v.uuid === localVideosPod3[0]) 508 const video0 = videos.find(v => v.uuid === localVideosServer3[0])
510 const video1 = videos.find(v => v.uuid === localVideosPod3[1]) 509 const video1 = videos.find(v => v.uuid === localVideosServer3[1])
511 510
512 expect(video0.views).to.equal(7) 511 expect(video0.views).to.equal(7)
513 expect(video1.views).to.equal(5) 512 expect(video1.views).to.equal(5)
@@ -518,16 +517,16 @@ describe('Test multiple pods', function () {
518 this.timeout(30000) 517 this.timeout(30000)
519 518
520 const tasks: Promise<any>[] = [] 519 const tasks: Promise<any>[] = []
521 tasks.push(getVideo(servers[0].url, remoteVideosPod1[0])) 520 tasks.push(getVideo(servers[0].url, remoteVideosServer1[0]))
522 tasks.push(getVideo(servers[1].url, remoteVideosPod2[0])) 521 tasks.push(getVideo(servers[1].url, remoteVideosServer2[0]))
523 tasks.push(getVideo(servers[1].url, remoteVideosPod2[0])) 522 tasks.push(getVideo(servers[1].url, remoteVideosServer2[0]))
524 tasks.push(getVideo(servers[2].url, remoteVideosPod3[0])) 523 tasks.push(getVideo(servers[2].url, remoteVideosServer3[0]))
525 tasks.push(getVideo(servers[2].url, remoteVideosPod3[1])) 524 tasks.push(getVideo(servers[2].url, remoteVideosServer3[1]))
526 tasks.push(getVideo(servers[2].url, remoteVideosPod3[1])) 525 tasks.push(getVideo(servers[2].url, remoteVideosServer3[1]))
527 tasks.push(getVideo(servers[2].url, remoteVideosPod3[1])) 526 tasks.push(getVideo(servers[2].url, remoteVideosServer3[1]))
528 tasks.push(getVideo(servers[2].url, localVideosPod3[1])) 527 tasks.push(getVideo(servers[2].url, localVideosServer3[1]))
529 tasks.push(getVideo(servers[2].url, localVideosPod3[1])) 528 tasks.push(getVideo(servers[2].url, localVideosServer3[1]))
530 tasks.push(getVideo(servers[2].url, localVideosPod3[1])) 529 tasks.push(getVideo(servers[2].url, localVideosServer3[1]))
531 530
532 await Promise.all(tasks) 531 await Promise.all(tasks)
533 532
@@ -557,13 +556,13 @@ describe('Test multiple pods', function () {
557 this.timeout(30000) 556 this.timeout(30000)
558 557
559 const tasks: Promise<any>[] = [] 558 const tasks: Promise<any>[] = []
560 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosPod1[0], 'like')) 559 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like'))
561 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosPod1[0], 'dislike')) 560 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'dislike'))
562 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosPod1[0], 'like')) 561 tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like'))
563 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, localVideosPod3[1], 'like')) 562 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'like'))
564 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, localVideosPod3[1], 'dislike')) 563 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'dislike'))
565 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, remoteVideosPod3[1], 'dislike')) 564 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[1], 'dislike'))
566 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, remoteVideosPod3[0], 'like')) 565 tasks.push(rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like'))
567 566
568 await Promise.all(tasks) 567 await Promise.all(tasks)
569 568
@@ -591,7 +590,7 @@ describe('Test multiple pods', function () {
591 }) 590 })
592 591
593 describe('Should manipulate these videos', function () { 592 describe('Should manipulate these videos', function () {
594 it('Should update the video 3 by asking pod 3', async function () { 593 it('Should update the video 3 by asking server 3', async function () {
595 this.timeout(15000) 594 this.timeout(15000)
596 595
597 const attributes = { 596 const attributes = {
@@ -609,7 +608,7 @@ describe('Test multiple pods', function () {
609 await wait(11000) 608 await wait(11000)
610 }) 609 })
611 610
612 it('Should have the video 3 updated on each pod', async function () { 611 it('Should have the video 3 updated on each server', async function () {
613 this.timeout(200000) 612 this.timeout(200000)
614 613
615 for (const server of servers) { 614 for (const server of servers) {
@@ -651,7 +650,7 @@ describe('Test multiple pods', function () {
651 } 650 }
652 }) 651 })
653 652
654 it('Should remove the videos 3 and 3-2 by asking pod 3', async function () { 653 it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
655 this.timeout(15000) 654 this.timeout(15000)
656 655
657 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id) 656 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
@@ -660,7 +659,7 @@ describe('Test multiple pods', function () {
660 await wait(11000) 659 await wait(11000)
661 }) 660 })
662 661
663 it('Should have videos 1 and 3 on each pod', async function () { 662 it('Should have videos 1 and 3 on each server', async function () {
664 for (const server of servers) { 663 for (const server of servers) {
665 const res = await getVideosList(server.url) 664 const res = await getVideosList(server.url)
666 665
@@ -673,11 +672,11 @@ describe('Test multiple pods', function () {
673 expect(videos[0].name).not.to.equal(toRemove[1].name) 672 expect(videos[0].name).not.to.equal(toRemove[1].name)
674 expect(videos[1].name).not.to.equal(toRemove[1].name) 673 expect(videos[1].name).not.to.equal(toRemove[1].name)
675 674
676 videoUUID = videos.find(video => video.name === 'my super name for pod 1').uuid 675 videoUUID = videos.find(video => video.name === 'my super name for server 1').uuid
677 } 676 }
678 }) 677 })
679 678
680 it('Should get the same video by UUID on each pod', async function () { 679 it('Should get the same video by UUID on each server', async function () {
681 let baseVideo = null 680 let baseVideo = null
682 for (const server of servers) { 681 for (const server of servers) {
683 const res = await getVideo(server.url, videoUUID) 682 const res = await getVideo(server.url, videoUUID)
@@ -701,7 +700,7 @@ describe('Test multiple pods', function () {
701 } 700 }
702 }) 701 })
703 702
704 it('Should get the preview from each pod', async function () { 703 it('Should get the preview from each server', async function () {
705 for (const server of servers) { 704 for (const server of servers) {
706 const res = await getVideo(server.url, videoUUID) 705 const res = await getVideo(server.url, videoUUID)
707 const video = res.body 706 const video = res.body
diff --git a/server/tests/api/services.ts b/server/tests/api/services.ts
index c34c51f66..3e6506de4 100644
--- a/server/tests/api/services.ts
+++ b/server/tests/api/services.ts
@@ -14,7 +14,6 @@ import {
14 getOEmbed 14 getOEmbed
15} from '../utils' 15} from '../utils'
16import { runServer } from '../utils/servers' 16import { runServer } from '../utils/servers'
17import { Video } from '../../../client/src/app/videos/shared/video.model'
18 17
19describe('Test services', function () { 18describe('Test services', function () {
20 let server: ServerInfo = null 19 let server: ServerInfo = null
diff --git a/server/tests/api/single-pod.ts b/server/tests/api/single-server.ts
index 0a917f2ae..82ecc68ee 100644
--- a/server/tests/api/single-pod.ts
+++ b/server/tests/api/single-server.ts
@@ -34,7 +34,7 @@ import {
34 updateVideo 34 updateVideo
35} from '../utils' 35} from '../utils'
36 36
37describe('Test a single pod', function () { 37describe('Test a single server', function () {
38 let server: ServerInfo = null 38 let server: ServerInfo = null
39 let videoId = -1 39 let videoId = -1
40 let videoUUID = '' 40 let videoUUID = ''
diff --git a/server/tests/api/video-privacy.ts b/server/tests/api/video-privacy.ts
index eb1e4f873..bf91ead2e 100644
--- a/server/tests/api/video-privacy.ts
+++ b/server/tests/api/video-privacy.ts
@@ -40,14 +40,14 @@ describe('Test video privacy', function () {
40 }) 40 })
41 41
42 it('Should upload a private video on server 1', async function () { 42 it('Should upload a private video on server 1', async function () {
43 this.timeout(15000) 43 this.timeout(25000)
44 44
45 const attributes = { 45 const attributes = {
46 privacy: VideoPrivacy.PRIVATE 46 privacy: VideoPrivacy.PRIVATE
47 } 47 }
48 await uploadVideo(servers[0].url, servers[0].accessToken, attributes) 48 await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
49 49
50 await wait(11000) 50 await wait(15000)
51 }) 51 })
52 52
53 it('Should not have this private video on server 2', async function () { 53 it('Should not have this private video on server 2', async function () {
@@ -86,8 +86,8 @@ describe('Test video privacy', function () {
86 await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID) 86 await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID)
87 }) 87 })
88 88
89 it('Should upload a unlisted video on server 2', async function () { 89 it('Should upload an unlisted video on server 2', async function () {
90 this.timeout(30000) 90 this.timeout(50000)
91 91
92 const attributes = { 92 const attributes = {
93 name: 'unlisted video', 93 name: 'unlisted video',
@@ -95,7 +95,7 @@ describe('Test video privacy', function () {
95 } 95 }
96 await uploadVideo(servers[1].url, servers[1].accessToken, attributes) 96 await uploadVideo(servers[1].url, servers[1].accessToken, attributes)
97 97
98 await wait(22000) 98 await wait(40000)
99 }) 99 })
100 100
101 it('Should not have this unlisted video listed on server 1 and 2', async function () { 101 it('Should not have this unlisted video listed on server 1 and 2', async function () {
@@ -125,7 +125,7 @@ describe('Test video privacy', function () {
125 }) 125 })
126 126
127 it('Should update the private video to public on server 1', async function () { 127 it('Should update the private video to public on server 1', async function () {
128 this.timeout(15000) 128 this.timeout(40000)
129 129
130 const attribute = { 130 const attribute = {
131 name: 'super video public', 131 name: 'super video public',
@@ -134,10 +134,10 @@ describe('Test video privacy', function () {
134 134
135 await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute) 135 await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute)
136 136
137 await wait(11000) 137 await wait(30000)
138 }) 138 })
139 139
140 it('Should not have this new unlisted video listed on server 1 and 2', async function () { 140 it('Should have this new public video listed on server 1 and 2', async function () {
141 for (const server of servers) { 141 for (const server of servers) {
142 const res = await getVideosList(server.url) 142 const res = await getVideosList(server.url)
143 143