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/remotes.ts2
-rw-r--r--server/tests/api/check-params/video-channels.ts310
-rw-r--r--server/tests/api/check-params/videos.ts123
-rw-r--r--server/tests/api/friends-advanced.ts61
-rw-r--r--server/tests/api/friends-basic.ts6
-rw-r--r--server/tests/api/multiple-pods.ts134
-rw-r--r--server/tests/api/request-schedulers.ts2
-rw-r--r--server/tests/api/single-pod.ts63
-rw-r--r--server/tests/api/users.ts2
-rw-r--r--server/tests/api/video-channels.ts141
-rw-r--r--server/tests/api/video-transcoder.ts17
11 files changed, 753 insertions, 108 deletions
diff --git a/server/tests/api/check-params/remotes.ts b/server/tests/api/check-params/remotes.ts
index 9456ae665..6d1747442 100644
--- a/server/tests/api/check-params/remotes.ts
+++ b/server/tests/api/check-params/remotes.ts
@@ -1,5 +1,7 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import 'mocha'
4
3import { 5import {
4 ServerInfo, 6 ServerInfo,
5 flushTests, 7 flushTests,
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
new file mode 100644
index 000000000..b99b5eda8
--- /dev/null
+++ b/server/tests/api/check-params/video-channels.ts
@@ -0,0 +1,310 @@
1/* tslint:disable:no-unused-expression */
2
3import * as request from 'supertest'
4import { join } from 'path'
5import 'mocha'
6import * as chai from 'chai'
7const expect = chai.expect
8
9import {
10 ServerInfo,
11 flushTests,
12 runServer,
13 makePutBodyRequest,
14 setAccessTokensToServers,
15 killallServers,
16 getMyUserInformation,
17 makePostBodyRequest,
18 getVideoChannelsList,
19 createUser,
20 getUserAccessToken
21} from '../../utils'
22
23describe('Test videos API validator', function () {
24 const path = '/api/v1/videos/channels'
25 let server: ServerInfo
26 let channelId: number
27 let accessTokenUser: string
28
29 // ---------------------------------------------------------------
30
31 before(async function () {
32 this.timeout(20000)
33
34 await flushTests()
35
36 server = await runServer(1)
37
38 await setAccessTokensToServers([ server ])
39
40 const res = await getMyUserInformation(server.url, server.accessToken)
41 channelId = res.body.videoChannels[0].id
42
43 const user = {
44 username: 'fake',
45 password: 'fake_password'
46 }
47 await createUser(server.url, server.accessToken, user.username, user.password)
48
49 accessTokenUser = await getUserAccessToken(server, user)
50 })
51
52 describe('When listing a video channels', function () {
53 it('Should fail with a bad start pagination', async function () {
54 await request(server.url)
55 .get(path)
56 .query({ start: 'hello' })
57 .set('Accept', 'application/json')
58 .expect(400)
59 })
60
61 it('Should fail with a bad count pagination', async function () {
62 await request(server.url)
63 .get(path)
64 .query({ count: 'hello' })
65 .set('Accept', 'application/json')
66 .expect(400)
67 })
68
69 it('Should fail with an incorrect sort', async function () {
70 await request(server.url)
71 .get(path)
72 .query({ sort: 'hello' })
73 .set('Accept', 'application/json')
74 .expect(400)
75 })
76 })
77
78 describe('When listing author video channels', function () {
79 it('Should fail with bad author', async function () {
80 const path = '/api/v1/videos/authors/hello/channels'
81
82 await request(server.url)
83 .get(path)
84 .set('Accept', 'application/json')
85 .expect(400)
86 })
87
88 it('Should fail with a unknown author', async function () {
89 const path = '/api/v1/videos/authors/156/channels'
90
91 await request(server.url)
92 .get(path)
93 .set('Accept', 'application/json')
94 .expect(404)
95 })
96 })
97
98 describe('When adding a video channel', function () {
99
100 it('Should fail with a non authenticated user', async function () {
101 const fields = {
102 name: 'hello',
103 description: 'super description'
104 }
105 await makePostBodyRequest({ url: server.url, path, token: 'none', fields, statusCodeExpected: 401 })
106 })
107
108 it('Should fail with nothing', async function () {
109 const fields = {}
110 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
111 })
112
113 it('Should fail without name', async function () {
114 const fields = {
115 description: 'super description'
116 }
117 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
118 })
119
120 it('Should fail with a long name', async function () {
121 const fields = {
122 name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
123 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',
124 description: 'super description'
125 }
126 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
127 })
128
129 it('Should fail with a long description', async function () {
130 const fields = {
131 name: 'hello',
132 description: 'super toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
133 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0' +
134 'ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
135 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long description'
136 }
137 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
138 })
139
140 it('Should succeed with the correct parameters', async function () {
141 const fields = {
142 name: 'hello',
143 description: 'super description'
144 }
145 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 204 })
146 })
147 })
148
149 describe('When updating a video channel', function () {
150 let videoChannelId
151
152 before(async function () {
153 const res = await getVideoChannelsList(server.url, 0, 1)
154 videoChannelId = res.body.data[0].id
155 })
156
157 it('Should fail with a non authenticated user', async function () {
158 const fields = {
159 name: 'hello',
160 description: 'super description'
161 }
162 await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: 'hi', fields, statusCodeExpected: 401 })
163 })
164
165 it('Should fail with another authenticated user', async function () {
166 const fields = {
167 name: 'hello',
168 description: 'super description'
169 }
170 await makePutBodyRequest({
171 url: server.url,
172 path: path + '/' + videoChannelId,
173 token: accessTokenUser,
174 fields,
175 statusCodeExpected: 403
176 })
177 })
178
179 it('Should fail with a long name', async function () {
180 const fields = {
181 name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
182 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',
183 description: 'super description'
184 }
185 await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields })
186 })
187
188 it('Should fail with a long description', async function () {
189 const fields = {
190 name: 'hello',
191 description: 'super toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
192 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0' +
193 'ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
194 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long description'
195 }
196 await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields })
197 })
198
199 it('Should succeed with the correct parameters', async function () {
200 const fields = {
201 name: 'hello 2',
202 description: 'super description 2'
203 }
204 await makePutBodyRequest({
205 url: server.url,
206 path: path + '/' + videoChannelId,
207 token: server.accessToken,
208 fields,
209 statusCodeExpected: 204
210 })
211 })
212 })
213
214 describe('When getting a video channel', function () {
215 let videoChannelId: number
216
217 before(async function () {
218 const res = await getVideoChannelsList(server.url, 0, 1)
219 videoChannelId = res.body.data[0].id
220 })
221
222 it('Should return the list of the video channels with nothing', async function () {
223 const res = await request(server.url)
224 .get(path)
225 .set('Accept', 'application/json')
226 .expect(200)
227 .expect('Content-Type', /json/)
228
229 expect(res.body.data).to.be.an('array')
230 })
231
232 it('Should fail without a correct uuid', async function () {
233 await request(server.url)
234 .get(path + '/coucou')
235 .set('Accept', 'application/json')
236 .expect(400)
237 })
238
239 it('Should return 404 with an incorrect video channel', async function () {
240 await request(server.url)
241 .get(path + '/4da6fde3-88f7-4d16-b119-108df5630b06')
242 .set('Accept', 'application/json')
243 .expect(404)
244 })
245
246 it('Should succeed with the correct parameters', async function () {
247 await request(server.url)
248 .get(path + '/' + videoChannelId)
249 .set('Accept', 'application/json')
250 .expect(200)
251 })
252 })
253
254 describe('When deleting a video channel', function () {
255 let videoChannelId: number
256
257 before(async function () {
258 const res = await getVideoChannelsList(server.url, 0, 1)
259 videoChannelId = res.body.data[0].id
260 })
261
262 it('Should fail with a non authenticated user', async function () {
263 await request(server.url)
264 .delete(path + '/' + videoChannelId)
265 .set('Authorization', 'Bearer coucou')
266 .expect(401)
267 })
268
269 it('Should fail with another authenticated user', async function () {
270 await request(server.url)
271 .delete(path + '/' + videoChannelId)
272 .set('Authorization', 'Bearer ' + accessTokenUser)
273 .expect(403)
274 })
275
276 it('Should fail with an unknown id', async function () {
277 await request(server.url)
278 .delete(path + '/454554')
279 .set('Authorization', 'Bearer ' + server.accessToken)
280 .expect(404)
281 })
282
283 it('Should succeed with the correct parameters', async function () {
284 await request(server.url)
285 .delete(path + '/' + videoChannelId)
286 .set('Authorization', 'Bearer ' + server.accessToken)
287 .expect(204)
288 })
289
290 it('Should fail to delete the last user video channel', async function () {
291 const res = await getVideoChannelsList(server.url, 0, 1)
292 videoChannelId = res.body.data[0].id
293
294 await request(server.url)
295 .delete(path + '/' + videoChannelId)
296 .set('Authorization', 'Bearer ' + server.accessToken)
297 .expect(409
298 )
299 })
300 })
301
302 after(async function () {
303 killallServers([ server ])
304
305 // Keep the logs if the test failed
306 if (this['ok']) {
307 await flushTests()
308 }
309 })
310})
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index af75d33c1..167b45b61 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -14,12 +14,16 @@ import {
14 makePutBodyRequest, 14 makePutBodyRequest,
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 killallServers, 16 killallServers,
17 makePostUploadRequest 17 makePostUploadRequest,
18 getMyUserInformation,
19 createUser,
20 getUserAccessToken
18} from '../../utils' 21} from '../../utils'
19 22
20describe('Test videos API validator', function () { 23describe('Test videos API validator', function () {
21 const path = '/api/v1/videos/' 24 const path = '/api/v1/videos/'
22 let server: ServerInfo 25 let server: ServerInfo
26 let channelId: number
23 27
24 // --------------------------------------------------------------- 28 // ---------------------------------------------------------------
25 29
@@ -31,6 +35,9 @@ describe('Test videos API validator', function () {
31 server = await runServer(1) 35 server = await runServer(1)
32 36
33 await setAccessTokensToServers([ server ]) 37 await setAccessTokensToServers([ server ])
38
39 const res = await getMyUserInformation(server.url, server.accessToken)
40 channelId = res.body.videoChannels[0].id
34 }) 41 })
35 42
36 describe('When listing a video', function () { 43 describe('When listing a video', function () {
@@ -106,7 +113,8 @@ describe('Test videos API validator', function () {
106 language: 6, 113 language: 6,
107 nsfw: false, 114 nsfw: false,
108 description: 'my super description', 115 description: 'my super description',
109 tags: [ 'tag1', 'tag2' ] 116 tags: [ 'tag1', 'tag2' ],
117 channelId
110 } 118 }
111 const attaches = { 119 const attaches = {
112 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 120 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -122,7 +130,8 @@ describe('Test videos API validator', function () {
122 language: 6, 130 language: 6,
123 nsfw: false, 131 nsfw: false,
124 description: 'my super description', 132 description: 'my super description',
125 tags: [ 'tag1', 'tag2' ] 133 tags: [ 'tag1', 'tag2' ],
134 channelId
126 } 135 }
127 const attaches = { 136 const attaches = {
128 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 137 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -137,7 +146,8 @@ describe('Test videos API validator', function () {
137 language: 6, 146 language: 6,
138 nsfw: false, 147 nsfw: false,
139 description: 'my super description', 148 description: 'my super description',
140 tags: [ 'tag1', 'tag2' ] 149 tags: [ 'tag1', 'tag2' ],
150 channelId
141 } 151 }
142 const attaches = { 152 const attaches = {
143 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 153 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -153,7 +163,8 @@ describe('Test videos API validator', function () {
153 language: 6, 163 language: 6,
154 nsfw: false, 164 nsfw: false,
155 description: 'my super description', 165 description: 'my super description',
156 tags: [ 'tag1', 'tag2' ] 166 tags: [ 'tag1', 'tag2' ],
167 channelId
157 } 168 }
158 const attaches = { 169 const attaches = {
159 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 170 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -168,7 +179,8 @@ describe('Test videos API validator', function () {
168 language: 6, 179 language: 6,
169 nsfw: false, 180 nsfw: false,
170 description: 'my super description', 181 description: 'my super description',
171 tags: [ 'tag1', 'tag2' ] 182 tags: [ 'tag1', 'tag2' ],
183 channelId
172 } 184 }
173 const attaches = { 185 const attaches = {
174 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 186 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -184,7 +196,8 @@ describe('Test videos API validator', function () {
184 language: 6, 196 language: 6,
185 nsfw: false, 197 nsfw: false,
186 description: 'my super description', 198 description: 'my super description',
187 tags: [ 'tag1', 'tag2' ] 199 tags: [ 'tag1', 'tag2' ],
200 channelId
188 } 201 }
189 const attaches = { 202 const attaches = {
190 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 203 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -200,7 +213,8 @@ describe('Test videos API validator', function () {
200 language: 563, 213 language: 563,
201 nsfw: false, 214 nsfw: false,
202 description: 'my super description', 215 description: 'my super description',
203 tags: [ 'tag1', 'tag2' ] 216 tags: [ 'tag1', 'tag2' ],
217 channelId
204 } 218 }
205 const attaches = { 219 const attaches = {
206 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 220 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -215,7 +229,8 @@ describe('Test videos API validator', function () {
215 licence: 4, 229 licence: 4,
216 language: 6, 230 language: 6,
217 description: 'my super description', 231 description: 'my super description',
218 tags: [ 'tag1', 'tag2' ] 232 tags: [ 'tag1', 'tag2' ],
233 channelId
219 } 234 }
220 const attaches = { 235 const attaches = {
221 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 236 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -223,7 +238,7 @@ describe('Test videos API validator', function () {
223 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 238 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
224 }) 239 })
225 240
226 it('Should fail with a bad nsfw attribue', async function () { 241 it('Should fail with a bad nsfw attribute', async function () {
227 const fields = { 242 const fields = {
228 name: 'my super name', 243 name: 'my super name',
229 category: 5, 244 category: 5,
@@ -231,7 +246,8 @@ describe('Test videos API validator', function () {
231 language: 6, 246 language: 6,
232 nsfw: 2, 247 nsfw: 2,
233 description: 'my super description', 248 description: 'my super description',
234 tags: [ 'tag1', 'tag2' ] 249 tags: [ 'tag1', 'tag2' ],
250 channelId
235 } 251 }
236 const attaches = { 252 const attaches = {
237 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 253 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -246,7 +262,8 @@ describe('Test videos API validator', function () {
246 licence: 1, 262 licence: 1,
247 language: 6, 263 language: 6,
248 nsfw: false, 264 nsfw: false,
249 tags: [ 'tag1', 'tag2' ] 265 tags: [ 'tag1', 'tag2' ],
266 channelId
250 } 267 }
251 const attaches = { 268 const attaches = {
252 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 269 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -264,6 +281,23 @@ describe('Test videos API validator', function () {
264 description: 'my super description which is very very very very very very very very very very very very very very' + 281 description: 'my super description which is very very very very very very very very very very very very very very' +
265 'very very very very very very very very very very very very very very very very very very very very very' + 282 'very very very very very very very very very very very very very very very very very very very very very' +
266 'very very very very very very very very very very very very very very very long', 283 'very very very very very very very very very very very very very very very long',
284 tags: [ 'tag1', 'tag2' ],
285 channelId
286 }
287 const attaches = {
288 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
289 }
290 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
291 })
292
293 it('Should fail without a channel', async function () {
294 const fields = {
295 name: 'my super name',
296 category: 5,
297 licence: 1,
298 language: 6,
299 nsfw: false,
300 description: 'my super description',
267 tags: [ 'tag1', 'tag2' ] 301 tags: [ 'tag1', 'tag2' ]
268 } 302 }
269 const attaches = { 303 const attaches = {
@@ -272,6 +306,50 @@ describe('Test videos API validator', function () {
272 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 306 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
273 }) 307 })
274 308
309 it('Should fail with a bad channel', async function () {
310 const fields = {
311 name: 'my super name',
312 category: 5,
313 licence: 1,
314 language: 6,
315 nsfw: false,
316 description: 'my super description',
317 tags: [ 'tag1', 'tag2' ],
318 channelId: 545454
319 }
320 const attaches = {
321 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
322 }
323 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
324 })
325
326 it('Should fail with another user channel', async function () {
327 const user = {
328 username: 'fake',
329 password: 'fake_password'
330 }
331 await createUser(server.url, server.accessToken, user.username, user.password)
332
333 const accessTokenUser = await getUserAccessToken(server, user)
334 const res = await getMyUserInformation(server.url, accessTokenUser)
335 const channelId = res.body.videoChannels[0].id
336
337 const fields = {
338 name: 'my super name',
339 category: 5,
340 licence: 1,
341 language: 6,
342 nsfw: false,
343 description: 'my super description',
344 tags: [ 'tag1', 'tag2' ],
345 channelId
346 }
347 const attaches = {
348 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
349 }
350 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
351 })
352
275 it('Should fail with too many tags', async function () { 353 it('Should fail with too many tags', async function () {
276 const fields = { 354 const fields = {
277 name: 'my super name', 355 name: 'my super name',
@@ -280,7 +358,8 @@ describe('Test videos API validator', function () {
280 language: 6, 358 language: 6,
281 nsfw: false, 359 nsfw: false,
282 description: 'my super description', 360 description: 'my super description',
283 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 361 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ],
362 channelId
284 } 363 }
285 const attaches = { 364 const attaches = {
286 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 365 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -296,7 +375,8 @@ describe('Test videos API validator', function () {
296 language: 6, 375 language: 6,
297 nsfw: false, 376 nsfw: false,
298 description: 'my super description', 377 description: 'my super description',
299 tags: [ 'tag1', 't' ] 378 tags: [ 'tag1', 't' ],
379 channelId
300 } 380 }
301 const attaches = { 381 const attaches = {
302 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 382 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -312,7 +392,8 @@ describe('Test videos API validator', function () {
312 language: 6, 392 language: 6,
313 nsfw: false, 393 nsfw: false,
314 description: 'my super description', 394 description: 'my super description',
315 tags: [ 'my_super_tag_too_long', 'tag1' ] 395 tags: [ 'my_super_tag_too_long', 'tag1' ],
396 channelId
316 } 397 }
317 const attaches = { 398 const attaches = {
318 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 399 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
@@ -328,7 +409,8 @@ describe('Test videos API validator', function () {
328 language: 6, 409 language: 6,
329 nsfw: false, 410 nsfw: false,
330 description: 'my super description', 411 description: 'my super description',
331 tags: [ 'tag1', 'tag2' ] 412 tags: [ 'tag1', 'tag2' ],
413 channelId
332 } 414 }
333 const attaches = {} 415 const attaches = {}
334 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 416 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -342,7 +424,8 @@ describe('Test videos API validator', function () {
342 language: 6, 424 language: 6,
343 nsfw: false, 425 nsfw: false,
344 description: 'my super description', 426 description: 'my super description',
345 tags: [ 'tag1', 'tag2' ] 427 tags: [ 'tag1', 'tag2' ],
428 channelId
346 } 429 }
347 const attaches = { 430 const attaches = {
348 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') 431 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
@@ -358,7 +441,8 @@ describe('Test videos API validator', function () {
358 language: 6, 441 language: 6,
359 nsfw: false, 442 nsfw: false,
360 description: 'my super description', 443 description: 'my super description',
361 tags: [ 'tag1', 'tag2' ] 444 tags: [ 'tag1', 'tag2' ],
445 channelId
362 } 446 }
363 const attaches = { 447 const attaches = {
364 'videofile': join(__dirname, '..', 'fixtures', 'video_too_long.webm') 448 'videofile': join(__dirname, '..', 'fixtures', 'video_too_long.webm')
@@ -376,7 +460,8 @@ describe('Test videos API validator', function () {
376 language: 6, 460 language: 6,
377 nsfw: false, 461 nsfw: false,
378 description: 'my super description', 462 description: 'my super description',
379 tags: [ 'tag1', 'tag2' ] 463 tags: [ 'tag1', 'tag2' ],
464 channelId
380 } 465 }
381 const attaches = { 466 const attaches = {
382 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 467 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
diff --git a/server/tests/api/friends-advanced.ts b/server/tests/api/friends-advanced.ts
index dc5c83c5e..fbfdf227e 100644
--- a/server/tests/api/friends-advanced.ts
+++ b/server/tests/api/friends-advanced.ts
@@ -72,7 +72,7 @@ describe('Test advanced friends', function () {
72 await setAccessTokensToServers(servers) 72 await setAccessTokensToServers(servers)
73 }) 73 })
74 74
75 it('Should make friends with two pod each in a different group', async function () { 75 it('Should not make friends with two different groups', async function () {
76 this.timeout(20000) 76 this.timeout(20000)
77 77
78 // Pod 3 makes friend with the first one 78 // Pod 3 makes friend with the first one
@@ -81,7 +81,7 @@ describe('Test advanced friends', function () {
81 // Pod 4 makes friend with the second one 81 // Pod 4 makes friend with the second one
82 await makeFriendsWrapper(4) 82 await makeFriendsWrapper(4)
83 83
84 // Now if the fifth wants to make friends with the third et the first 84 // Now if the fifth wants to make friends with the third and the first
85 await makeFriendsWrapper(5) 85 await makeFriendsWrapper(5)
86 86
87 await wait(11000) 87 await wait(11000)
@@ -104,8 +104,8 @@ describe('Test advanced friends', function () {
104 } 104 }
105 }) 105 })
106 106
107 it('Should make friends with the pods 1, 2, 3', async function () { 107 it('Should remove bad pod and new pod should not become friend with it', async function () {
108 this.timeout(150000) 108 this.timeout(200000)
109 109
110 // Pods 1, 2, 3 and 4 become friends 110 // Pods 1, 2, 3 and 4 become friends
111 await makeFriendsWrapper(2) 111 await makeFriendsWrapper(2)
@@ -119,6 +119,9 @@ describe('Test advanced friends', function () {
119 expect(res.body.data.length).to.equal(3) 119 expect(res.body.data.length).to.equal(3)
120 } 120 }
121 121
122 // Wait initial video channel requests
123 await wait(11000)
124
122 // Kill pod 4 125 // Kill pod 4
123 servers[3].app.kill() 126 servers[3].app.kill()
124 127
@@ -133,6 +136,16 @@ describe('Test advanced friends', function () {
133 136
134 await wait(11000) 137 await wait(11000)
135 138
139 await uploadVideoWrapper(1)
140 await uploadVideoWrapper(2)
141
142 await wait(11000)
143
144 await uploadVideoWrapper(1)
145 await uploadVideoWrapper(2)
146
147 await wait(11000)
148
136 serverNumbersToTest = [ 1, 2 ] 149 serverNumbersToTest = [ 1, 2 ]
137 150
138 for (const i of serverNumbersToTest) { 151 for (const i of serverNumbersToTest) {
@@ -147,31 +160,39 @@ describe('Test advanced friends', function () {
147 } 160 }
148 } 161 }
149 162
150 // Rerun server 4 163 // Rerun server 4
151 const newServer = await runServer(4) 164 const newServer = await runServer(4)
152 servers[3].app = newServer.app 165 servers[3].app = newServer.app
153 servers[3].app 166 servers[3].app
154 167
155 const res1 = await getFriendsListWrapper(4)
156
157 // Pod 4 didn't know pod 1 and 2 removed it 168 // Pod 4 didn't know pod 1 and 2 removed it
169 const res1 = await getFriendsListWrapper(4)
158 expect(res1.body.data.length).to.equal(3) 170 expect(res1.body.data.length).to.equal(3)
159 171
172 // Pod 3 didn't upload video, it's still friend with pod 3
173 const res2 = await getFriendsListWrapper(3)
174 expect(res2.body.data.length).to.equal(3)
175
160 // Pod 6 asks pod 1, 2 and 3 176 // Pod 6 asks pod 1, 2 and 3
161 await makeFriendsWrapper(6) 177 await makeFriendsWrapper(6)
162 178
163 await wait(11000) 179 await wait(11000)
164 180
165 const res2 = await getFriendsListWrapper(6) 181 const res3 = await getFriendsListWrapper(6)
166 182
167 // Pod 4 should not be our friend 183 // Pod 4 should not be our friend
168 const friends = res2.body.data 184 const friends = res3.body.data
169 expect(friends.length).to.equal(3) 185 expect(friends.length).to.equal(3)
170 for (const pod of friends) { 186 for (const pod of friends) {
171 expect(pod.host).not.equal(servers[3].host) 187 expect(pod.host).not.equal(servers[3].host)
172 } 188 }
173 }) 189 })
174 190
191 // Pod 1 is friend with : 2 3 6
192 // Pod 2 is friend with : 1 3 6
193 // Pod 3 is friend with : 1 2 4 6
194 // Pod 4 is friend with : 1 2 3
195 // Pod 6 is friend with : 1 2 3
175 it('Should pod 1 quit friends', async function () { 196 it('Should pod 1 quit friends', async function () {
176 this.timeout(25000) 197 this.timeout(25000)
177 198
@@ -180,21 +201,26 @@ describe('Test advanced friends', function () {
180 201
181 await wait(15000) 202 await wait(15000)
182 203
204 // Pod 1 remove friends
183 await quitFriendsWrapper(1) 205 await quitFriendsWrapper(1)
184 206
185 // Remove pod 1 from pod 2
186 const res1 = await getVideosWrapper(1) 207 const res1 = await getVideosWrapper(1)
187 const videos1 = res1.body.data 208 const videos1 = res1.body.data
188 expect(videos1).to.be.an('array') 209 expect(videos1).to.be.an('array')
189 expect(videos1.length).to.equal(2) 210 expect(videos1.length).to.equal(4)
190 211
191 const res2 = await getVideosWrapper(2) 212 const res2 = await getVideosWrapper(2)
192 const videos2 = res2.body.data 213 const videos2 = res2.body.data
193 expect(videos2).to.be.an('array') 214 expect(videos2).to.be.an('array')
194 expect(videos2.length).to.equal(3) 215 expect(videos2.length).to.equal(5)
195 }) 216 })
196 217
197 it('Should make friends between pod 1 and 2 and exchange their videos', async function () { 218 // Pod 1 is friend with nothing
219 // Pod 2 is friend with : 3 6
220 // Pod 3 is friend with : 2 4 6
221 // Pod 4 is friend with : 2 3
222 // Pod 6 is friend with : 2 3
223 it('Should make friends between pod 1, 2, 3 and 6 and exchange their videos', async function () {
198 this.timeout(20000) 224 this.timeout(20000)
199 225
200 await makeFriendsWrapper(1) 226 await makeFriendsWrapper(1)
@@ -204,10 +230,15 @@ describe('Test advanced friends', function () {
204 const res = await getVideosWrapper(1) 230 const res = await getVideosWrapper(1)
205 const videos = res.body.data 231 const videos = res.body.data
206 expect(videos).to.be.an('array') 232 expect(videos).to.be.an('array')
207 expect(videos.length).to.equal(5) 233 expect(videos.length).to.equal(9)
208 }) 234 })
209 235
210 it('Should allow pod 6 to quit pod 1 & 2 and be friend with pod 3', async function () { 236 // Pod 1 is friend with : 2 3 6
237 // Pod 2 is friend with : 1 3 6
238 // Pod 3 is friend with : 1 2 4 6
239 // Pod 4 is friend with : 2 3
240 // Pod 6 is friend with : 1 2 3
241 it('Should allow pod 6 to quit pod 1, 2 and 3 and be friend with pod 3', async function () {
211 this.timeout(30000) 242 this.timeout(30000)
212 243
213 // Pod 3 should have 4 friends 244 // Pod 3 should have 4 friends
diff --git a/server/tests/api/friends-basic.ts b/server/tests/api/friends-basic.ts
index efca4fda2..31e180631 100644
--- a/server/tests/api/friends-basic.ts
+++ b/server/tests/api/friends-basic.ts
@@ -87,7 +87,7 @@ describe('Test basic friends', function () {
87 const pod1 = friends[0] 87 const pod1 = friends[0]
88 expect(pod1.host).to.equal(servers[2].host) 88 expect(pod1.host).to.equal(servers[2].host)
89 expect(pod1.email).to.equal('admin3@example.com') 89 expect(pod1.email).to.equal('admin3@example.com')
90 expect(pod1.score).to.equal(20) 90 expect(pod1.score).to.be.at.least(20)
91 expect(dateIsValid(pod1.createdAt)).to.be.true 91 expect(dateIsValid(pod1.createdAt)).to.be.true
92 92
93 // Same here, the third pod should have the second pod as a friend 93 // Same here, the third pod should have the second pod as a friend
@@ -99,7 +99,7 @@ describe('Test basic friends', function () {
99 const pod2 = result[0] 99 const pod2 = result[0]
100 expect(pod2.host).to.equal(servers[1].host) 100 expect(pod2.host).to.equal(servers[1].host)
101 expect(pod2.email).to.equal('admin2@example.com') 101 expect(pod2.email).to.equal('admin2@example.com')
102 expect(pod2.score).to.equal(20) 102 expect(pod2.score).to.be.at.least(20)
103 expect(dateIsValid(pod2.createdAt)).to.be.true 103 expect(dateIsValid(pod2.createdAt)).to.be.true
104 104
105 // Finally the first pod make friend with the second pod 105 // Finally the first pod make friend with the second pod
@@ -133,7 +133,7 @@ describe('Test basic friends', function () {
133 const pod = res.body.data[0] 133 const pod = res.body.data[0]
134 expect(pod.host).to.equal('localhost:9002') 134 expect(pod.host).to.equal('localhost:9002')
135 expect(pod.email).to.equal('admin2@example.com') 135 expect(pod.email).to.equal('admin2@example.com')
136 expect(pod.score).to.equal(20) 136 expect(pod.score).to.be.at.least(20)
137 expect(dateIsValid(pod.createdAt)).to.be.true 137 expect(dateIsValid(pod.createdAt)).to.be.true
138 }) 138 })
139 139
diff --git a/server/tests/api/multiple-pods.ts b/server/tests/api/multiple-pods.ts
index e0ccb3058..fe4e4a036 100644
--- a/server/tests/api/multiple-pods.ts
+++ b/server/tests/api/multiple-pods.ts
@@ -19,8 +19,12 @@ import {
19 updateVideo, 19 updateVideo,
20 uploadVideo, 20 uploadVideo,
21 wait, 21 wait,
22 webtorrentAdd 22 webtorrentAdd,
23 addVideoChannel,
24 getVideoChannelsList,
25 getUserAccessToken
23} from '../utils' 26} from '../utils'
27import { createUser } from '../utils/users'
24 28
25const expect = chai.expect 29const expect = chai.expect
26 30
@@ -28,6 +32,7 @@ describe('Test multiple pods', function () {
28 let servers: ServerInfo[] = [] 32 let servers: ServerInfo[] = []
29 const toRemove = [] 33 const toRemove = []
30 let videoUUID = '' 34 let videoUUID = ''
35 let videoChannelId: number
31 36
32 before(async function () { 37 before(async function () {
33 this.timeout(120000) 38 this.timeout(120000)
@@ -37,6 +42,14 @@ describe('Test multiple pods', function () {
37 // Get the access tokens 42 // Get the access tokens
38 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
39 44
45 const videoChannel = {
46 name: 'my channel',
47 description: 'super channel'
48 }
49 await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel)
50 const channelRes = await getVideoChannelsList(servers[0].url, 0, 1)
51 videoChannelId = channelRes.body.data[0].id
52
40 // The second pod make friend with the third 53 // The second pod make friend with the third
41 await makeFriends(servers[1].url, servers[1].accessToken) 54 await makeFriends(servers[1].url, servers[1].accessToken)
42 55
@@ -69,6 +82,7 @@ describe('Test multiple pods', function () {
69 nsfw: true, 82 nsfw: true,
70 description: 'my super description for pod 1', 83 description: 'my super description for pod 1',
71 tags: [ 'tag1p1', 'tag2p1' ], 84 tags: [ 'tag1p1', 'tag2p1' ],
85 channelId: videoChannelId,
72 fixture: 'video_short1.webm' 86 fixture: 'video_short1.webm'
73 } 87 }
74 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) 88 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
@@ -101,21 +115,30 @@ describe('Test multiple pods', function () {
101 expect(dateIsValid(video.updatedAt)).to.be.true 115 expect(dateIsValid(video.updatedAt)).to.be.true
102 expect(video.author).to.equal('root') 116 expect(video.author).to.equal('root')
103 117
104 expect(video.files).to.have.lengthOf(1) 118 const res2 = await getVideo(server.url, video.uuid)
119 const videoDetails = res2.body
120
121 expect(videoDetails.channel.name).to.equal('my channel')
122 expect(videoDetails.channel.description).to.equal('super channel')
123 expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true
124 expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true
125 expect(videoDetails.files).to.have.lengthOf(1)
105 126
106 const file = video.files[0] 127 const file = videoDetails.files[0]
107 const magnetUri = file.magnetUri 128 const magnetUri = file.magnetUri
108 expect(file.magnetUri).to.have.lengthOf.above(2) 129 expect(file.magnetUri).to.have.lengthOf.above(2)
109 expect(file.torrentUrl).to.equal(`http://${video.podHost}/static/torrents/${video.uuid}-${file.resolution}.torrent`) 130 expect(file.torrentUrl).to.equal(`http://${videoDetails.podHost}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
110 expect(file.fileUrl).to.equal(`http://${video.podHost}/static/webseed/${video.uuid}-${file.resolution}.webm`) 131 expect(file.fileUrl).to.equal(`http://${videoDetails.podHost}/static/webseed/${videoDetails.uuid}-${file.resolution}.webm`)
111 expect(file.resolution).to.equal(720) 132 expect(file.resolution).to.equal(720)
112 expect(file.resolutionLabel).to.equal('720p') 133 expect(file.resolutionLabel).to.equal('720p')
113 expect(file.size).to.equal(572456) 134 expect(file.size).to.equal(572456)
114 135
115 if (server.url !== 'http://localhost:9001') { 136 if (server.url !== 'http://localhost:9001') {
116 expect(video.isLocal).to.be.false 137 expect(video.isLocal).to.be.false
138 expect(videoDetails.channel.isLocal).to.be.false
117 } else { 139 } else {
118 expect(video.isLocal).to.be.true 140 expect(video.isLocal).to.be.true
141 expect(videoDetails.channel.isLocal).to.be.true
119 } 142 }
120 143
121 // All pods should have the same magnet Uri 144 // All pods should have the same magnet Uri
@@ -133,6 +156,13 @@ describe('Test multiple pods', function () {
133 it('Should upload the video on pod 2 and propagate on each pod', async function () { 156 it('Should upload the video on pod 2 and propagate on each pod', async function () {
134 this.timeout(120000) 157 this.timeout(120000)
135 158
159 const user = {
160 username: 'user1',
161 password: 'super_password'
162 }
163 await createUser(servers[1].url, servers[1].accessToken, user.username, user.password)
164 const userAccessToken = await getUserAccessToken(servers[1], user)
165
136 const videoAttributes = { 166 const videoAttributes = {
137 name: 'my super name for pod 2', 167 name: 'my super name for pod 2',
138 category: 4, 168 category: 4,
@@ -143,7 +173,7 @@ describe('Test multiple pods', function () {
143 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], 173 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
144 fixture: 'video_short2.webm' 174 fixture: 'video_short2.webm'
145 } 175 }
146 await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes) 176 await uploadVideo(servers[1].url, userAccessToken, videoAttributes)
147 177
148 // Transcoding, so wait more than 22000 178 // Transcoding, so wait more than 22000
149 await wait(60000) 179 await wait(60000)
@@ -172,20 +202,27 @@ describe('Test multiple pods', function () {
172 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) 202 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
173 expect(dateIsValid(video.createdAt)).to.be.true 203 expect(dateIsValid(video.createdAt)).to.be.true
174 expect(dateIsValid(video.updatedAt)).to.be.true 204 expect(dateIsValid(video.updatedAt)).to.be.true
175 expect(video.author).to.equal('root') 205 expect(video.author).to.equal('user1')
206
207 if (server.url !== 'http://localhost:9002') {
208 expect(video.isLocal).to.be.false
209 } else {
210 expect(video.isLocal).to.be.true
211 }
176 212
177 expect(video.files).to.have.lengthOf(4) 213 const res2 = await getVideo(server.url, video.uuid)
214 const videoDetails = res2.body
215
216 expect(videoDetails.channel.name).to.equal('Default user1 channel')
217 expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true
218 expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true
219
220 expect(videoDetails.files).to.have.lengthOf(4)
178 221
179 // Check common attributes 222 // Check common attributes
180 for (const file of video.files) { 223 for (const file of videoDetails.files) {
181 expect(file.magnetUri).to.have.lengthOf.above(2) 224 expect(file.magnetUri).to.have.lengthOf.above(2)
182 225
183 if (server.url !== 'http://localhost:9002') {
184 expect(video.isLocal).to.be.false
185 } else {
186 expect(video.isLocal).to.be.true
187 }
188
189 // All pods should have the same magnet Uri 226 // All pods should have the same magnet Uri
190 if (baseMagnet[file.resolution] === undefined) { 227 if (baseMagnet[file.resolution] === undefined) {
191 baseMagnet[file.resolution] = file.magnet 228 baseMagnet[file.resolution] = file.magnet
@@ -194,27 +231,27 @@ describe('Test multiple pods', function () {
194 } 231 }
195 } 232 }
196 233
197 const file240p = video.files.find(f => f.resolution === 240) 234 const file240p = videoDetails.files.find(f => f.resolution === 240)
198 expect(file240p).not.to.be.undefined 235 expect(file240p).not.to.be.undefined
199 expect(file240p.resolutionLabel).to.equal('240p') 236 expect(file240p.resolutionLabel).to.equal('240p')
200 expect(file240p.size).to.be.above(180000).and.below(200000) 237 expect(file240p.size).to.be.above(180000).and.below(200000)
201 238
202 const file360p = video.files.find(f => f.resolution === 360) 239 const file360p = videoDetails.files.find(f => f.resolution === 360)
203 expect(file360p).not.to.be.undefined 240 expect(file360p).not.to.be.undefined
204 expect(file360p.resolutionLabel).to.equal('360p') 241 expect(file360p.resolutionLabel).to.equal('360p')
205 expect(file360p.size).to.be.above(270000).and.below(290000) 242 expect(file360p.size).to.be.above(270000).and.below(290000)
206 243
207 const file480p = video.files.find(f => f.resolution === 480) 244 const file480p = videoDetails.files.find(f => f.resolution === 480)
208 expect(file480p).not.to.be.undefined 245 expect(file480p).not.to.be.undefined
209 expect(file480p.resolutionLabel).to.equal('480p') 246 expect(file480p.resolutionLabel).to.equal('480p')
210 expect(file480p.size).to.be.above(380000).and.below(400000) 247 expect(file480p.size).to.be.above(380000).and.below(400000)
211 248
212 const file720p = video.files.find(f => f.resolution === 720) 249 const file720p = videoDetails.files.find(f => f.resolution === 720)
213 expect(file720p).not.to.be.undefined 250 expect(file720p).not.to.be.undefined
214 expect(file720p.resolutionLabel).to.equal('720p') 251 expect(file720p.resolutionLabel).to.equal('720p')
215 expect(file720p.size).to.be.above(700000).and.below(7200000) 252 expect(file720p.size).to.be.above(700000).and.below(7200000)
216 253
217 const test = await testVideoImage(server.url, 'video_short2.webm', video.thumbnailPath) 254 const test = await testVideoImage(server.url, 'video_short2.webm', videoDetails.thumbnailPath)
218 expect(test).to.equal(true) 255 expect(test).to.equal(true)
219 } 256 }
220 }) 257 })
@@ -284,9 +321,11 @@ describe('Test multiple pods', function () {
284 expect(dateIsValid(video1.createdAt)).to.be.true 321 expect(dateIsValid(video1.createdAt)).to.be.true
285 expect(dateIsValid(video1.updatedAt)).to.be.true 322 expect(dateIsValid(video1.updatedAt)).to.be.true
286 323
287 expect(video1.files).to.have.lengthOf(1) 324 const res2 = await getVideo(server.url, video1.id)
325 const video1Details = res2.body
326 expect(video1Details.files).to.have.lengthOf(1)
288 327
289 const file1 = video1.files[0] 328 const file1 = video1Details.files[0]
290 expect(file1.magnetUri).to.have.lengthOf.above(2) 329 expect(file1.magnetUri).to.have.lengthOf.above(2)
291 expect(file1.resolution).to.equal(720) 330 expect(file1.resolution).to.equal(720)
292 expect(file1.resolutionLabel).to.equal('720p') 331 expect(file1.resolutionLabel).to.equal('720p')
@@ -308,9 +347,12 @@ describe('Test multiple pods', function () {
308 expect(dateIsValid(video2.createdAt)).to.be.true 347 expect(dateIsValid(video2.createdAt)).to.be.true
309 expect(dateIsValid(video2.updatedAt)).to.be.true 348 expect(dateIsValid(video2.updatedAt)).to.be.true
310 349
311 expect(video2.files).to.have.lengthOf(1) 350 const res3 = await getVideo(server.url, video2.id)
351 const video2Details = res3.body
312 352
313 const file2 = video2.files[0] 353 expect(video2Details.files).to.have.lengthOf(1)
354
355 const file2 = video2Details.files[0]
314 const magnetUri2 = file2.magnetUri 356 const magnetUri2 = file2.magnetUri
315 expect(file2.magnetUri).to.have.lengthOf.above(2) 357 expect(file2.magnetUri).to.have.lengthOf.above(2)
316 expect(file2.resolution).to.equal(720) 358 expect(file2.resolution).to.equal(720)
@@ -352,7 +394,10 @@ describe('Test multiple pods', function () {
352 toRemove.push(res.body.data[2]) 394 toRemove.push(res.body.data[2])
353 toRemove.push(res.body.data[3]) 395 toRemove.push(res.body.data[3])
354 396
355 const torrent = await webtorrentAdd(video.files[0].magnetUri) 397 const res2 = await getVideo(servers[2].url, video.id)
398 const videoDetails = res2.body
399
400 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
356 expect(torrent.files).to.be.an('array') 401 expect(torrent.files).to.be.an('array')
357 expect(torrent.files.length).to.equal(1) 402 expect(torrent.files.length).to.equal(1)
358 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 403 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
@@ -365,8 +410,10 @@ describe('Test multiple pods', function () {
365 const res = await getVideosList(servers[0].url) 410 const res = await getVideosList(servers[0].url)
366 411
367 const video = res.body.data[1] 412 const video = res.body.data[1]
413 const res2 = await getVideo(servers[0].url, video.id)
414 const videoDetails = res2.body
368 415
369 const torrent = await webtorrentAdd(video.files[0].magnetUri) 416 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
370 expect(torrent.files).to.be.an('array') 417 expect(torrent.files).to.be.an('array')
371 expect(torrent.files.length).to.equal(1) 418 expect(torrent.files.length).to.equal(1)
372 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 419 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
@@ -379,8 +426,10 @@ describe('Test multiple pods', function () {
379 const res = await getVideosList(servers[1].url) 426 const res = await getVideosList(servers[1].url)
380 427
381 const video = res.body.data[2] 428 const video = res.body.data[2]
429 const res2 = await getVideo(servers[1].url, video.id)
430 const videoDetails = res2.body
382 431
383 const torrent = await webtorrentAdd(video.files[0].magnetUri) 432 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
384 expect(torrent.files).to.be.an('array') 433 expect(torrent.files).to.be.an('array')
385 expect(torrent.files.length).to.equal(1) 434 expect(torrent.files.length).to.equal(1)
386 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 435 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
@@ -393,8 +442,10 @@ describe('Test multiple pods', function () {
393 const res = await getVideosList(servers[0].url) 442 const res = await getVideosList(servers[0].url)
394 443
395 const video = res.body.data[3] 444 const video = res.body.data[3]
445 const res2 = await getVideo(servers[0].url, video.id)
446 const videoDetails = res2.body
396 447
397 const torrent = await webtorrentAdd(video.files[0].magnetUri) 448 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
398 expect(torrent.files).to.be.an('array') 449 expect(torrent.files).to.be.an('array')
399 expect(torrent.files.length).to.equal(1) 450 expect(torrent.files.length).to.equal(1)
400 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 451 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
@@ -407,7 +458,10 @@ describe('Test multiple pods', function () {
407 const res = await getVideosList(servers[0].url) 458 const res = await getVideosList(servers[0].url)
408 459
409 const video = res.body.data.find(v => v.name === 'my super name for pod 2') 460 const video = res.body.data.find(v => v.name === 'my super name for pod 2')
410 const file = video.files.find(f => f.resolution === 360) 461 const res2 = await getVideo(servers[0].url, video.id)
462 const videoDetails = res2.body
463
464 const file = videoDetails.files.find(f => f.resolution === 360)
411 expect(file).not.to.be.undefined 465 expect(file).not.to.be.undefined
412 466
413 const torrent = await webtorrentAdd(file.magnetUri) 467 const torrent = await webtorrentAdd(file.magnetUri)
@@ -425,14 +479,14 @@ describe('Test multiple pods', function () {
425 479
426 before(async function () { 480 before(async function () {
427 const res1 = await getVideosList(servers[0].url) 481 const res1 = await getVideosList(servers[0].url)
428 remoteVideosPod1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.id) 482 remoteVideosPod1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
429 483
430 const res2 = await getVideosList(servers[1].url) 484 const res2 = await getVideosList(servers[1].url)
431 remoteVideosPod2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.id) 485 remoteVideosPod2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
432 486
433 const res3 = await getVideosList(servers[2].url) 487 const res3 = await getVideosList(servers[2].url)
434 localVideosPod3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.id) 488 localVideosPod3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.uuid)
435 remoteVideosPod3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.id) 489 remoteVideosPod3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
436 }) 490 })
437 491
438 it('Should view multiple videos on owned servers', async function () { 492 it('Should view multiple videos on owned servers', async function () {
@@ -452,8 +506,11 @@ describe('Test multiple pods', function () {
452 const res = await getVideosList(server.url) 506 const res = await getVideosList(server.url)
453 507
454 const videos = res.body.data 508 const videos = res.body.data
455 expect(videos.find(video => video.views === 3)).to.be.an('object') 509 const video0 = videos.find(v => v.uuid === localVideosPod3[0])
456 expect(videos.find(video => video.views === 1)).to.be.an('object') 510 const video1 = videos.find(v => v.uuid === localVideosPod3[1])
511
512 expect(video0.views).to.equal(4)
513 expect(video1.views).to.equal(2)
457 } 514 }
458 }) 515 })
459 516
@@ -573,7 +630,10 @@ describe('Test multiple pods', function () {
573 expect(videoUpdated.tags).to.deep.equal([ 'tag_up_1', 'tag_up_2' ]) 630 expect(videoUpdated.tags).to.deep.equal([ 'tag_up_1', 'tag_up_2' ])
574 expect(dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true 631 expect(dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true
575 632
576 const file = videoUpdated.files[0] 633 const res2 = await getVideo(server.url, videoUpdated.uuid)
634 const videoUpdatedDetails = res2.body
635
636 const file = videoUpdatedDetails .files[0]
577 expect(file.magnetUri).to.have.lengthOf.above(2) 637 expect(file.magnetUri).to.have.lengthOf.above(2)
578 expect(file.resolution).to.equal(720) 638 expect(file.resolution).to.equal(720)
579 expect(file.resolutionLabel).to.equal('720p') 639 expect(file.resolutionLabel).to.equal('720p')
@@ -584,7 +644,7 @@ describe('Test multiple pods', function () {
584 644
585 // Avoid "duplicate torrent" errors 645 // Avoid "duplicate torrent" errors
586 const refreshWebTorrent = true 646 const refreshWebTorrent = true
587 const torrent = await webtorrentAdd(videoUpdated.files[0].magnetUri, refreshWebTorrent) 647 const torrent = await webtorrentAdd(videoUpdatedDetails .files[0].magnetUri, refreshWebTorrent)
588 expect(torrent.files).to.be.an('array') 648 expect(torrent.files).to.be.an('array')
589 expect(torrent.files.length).to.equal(1) 649 expect(torrent.files.length).to.equal(1)
590 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 650 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
diff --git a/server/tests/api/request-schedulers.ts b/server/tests/api/request-schedulers.ts
index 2e91e7c61..c136d1cea 100644
--- a/server/tests/api/request-schedulers.ts
+++ b/server/tests/api/request-schedulers.ts
@@ -68,7 +68,7 @@ describe('Test requests schedulers stats', function () {
68 const res = await getRequestsStats(server) 68 const res = await getRequestsStats(server)
69 const requestSchedulers = res.body 69 const requestSchedulers = res.body
70 const requestScheduler = requestSchedulers.requestScheduler 70 const requestScheduler = requestSchedulers.requestScheduler
71 expect(requestScheduler.totalRequests).to.equal(1) 71 expect(requestScheduler.totalRequests).to.equal(3)
72 }) 72 })
73 73
74 after(async function () { 74 after(async function () {
diff --git a/server/tests/api/single-pod.ts b/server/tests/api/single-pod.ts
index 71017b2b3..d3a982436 100644
--- a/server/tests/api/single-pod.ts
+++ b/server/tests/api/single-pod.ts
@@ -122,22 +122,25 @@ describe('Test a single pod', function () {
122 expect(dateIsValid(video.createdAt)).to.be.true 122 expect(dateIsValid(video.createdAt)).to.be.true
123 expect(dateIsValid(video.updatedAt)).to.be.true 123 expect(dateIsValid(video.updatedAt)).to.be.true
124 124
125 expect(video.files).to.have.lengthOf(1) 125 const res2 = await getVideo(server.url, res.body.data[0].id)
126 const videoDetails = res2.body
126 127
127 const file = video.files[0] 128 expect(videoDetails.files).to.have.lengthOf(1)
129
130 const file = videoDetails.files[0]
128 const magnetUri = file.magnetUri 131 const magnetUri = file.magnetUri
129 expect(file.magnetUri).to.have.lengthOf.above(2) 132 expect(file.magnetUri).to.have.lengthOf.above(2)
130 expect(file.torrentUrl).to.equal(`${server.url}/static/torrents/${video.uuid}-${file.resolution}.torrent`) 133 expect(file.torrentUrl).to.equal(`${server.url}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
131 expect(file.fileUrl).to.equal(`${server.url}/static/webseed/${video.uuid}-${file.resolution}.webm`) 134 expect(file.fileUrl).to.equal(`${server.url}/static/webseed/${videoDetails.uuid}-${file.resolution}.webm`)
132 expect(file.resolution).to.equal(720) 135 expect(file.resolution).to.equal(720)
133 expect(file.resolutionLabel).to.equal('720p') 136 expect(file.resolutionLabel).to.equal('720p')
134 expect(file.size).to.equal(218910) 137 expect(file.size).to.equal(218910)
135 138
136 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 139 const test = await testVideoImage(server.url, 'video_short.webm', videoDetails.thumbnailPath)
137 expect(test).to.equal(true) 140 expect(test).to.equal(true)
138 141
139 videoId = video.id 142 videoId = videoDetails.id
140 videoUUID = video.uuid 143 videoUUID = videoDetails.uuid
141 144
142 const torrent = await webtorrentAdd(magnetUri) 145 const torrent = await webtorrentAdd(magnetUri)
143 expect(torrent.files).to.be.an('array') 146 expect(torrent.files).to.be.an('array')
@@ -167,6 +170,10 @@ describe('Test a single pod', function () {
167 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 170 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
168 expect(dateIsValid(video.createdAt)).to.be.true 171 expect(dateIsValid(video.createdAt)).to.be.true
169 expect(dateIsValid(video.updatedAt)).to.be.true 172 expect(dateIsValid(video.updatedAt)).to.be.true
173 expect(video.channel.name).to.equal('Default root channel')
174 expect(video.channel.isLocal).to.be.true
175 expect(dateIsValid(video.channel.createdAt)).to.be.true
176 expect(dateIsValid(video.channel.updatedAt)).to.be.true
170 177
171 expect(video.files).to.have.lengthOf(1) 178 expect(video.files).to.have.lengthOf(1)
172 179
@@ -200,7 +207,7 @@ describe('Test a single pod', function () {
200 const res = await getVideo(server.url, videoId) 207 const res = await getVideo(server.url, videoId)
201 208
202 const video = res.body 209 const video = res.body
203 expect(video.views).to.equal(2) 210 expect(video.views).to.equal(3)
204 }) 211 })
205 212
206 it('Should search the video by name by default', async function () { 213 it('Should search the video by name by default', async function () {
@@ -227,14 +234,6 @@ describe('Test a single pod', function () {
227 expect(dateIsValid(video.createdAt)).to.be.true 234 expect(dateIsValid(video.createdAt)).to.be.true
228 expect(dateIsValid(video.updatedAt)).to.be.true 235 expect(dateIsValid(video.updatedAt)).to.be.true
229 236
230 expect(video.files).to.have.lengthOf(1)
231
232 const file = video.files[0]
233 expect(file.magnetUri).to.have.lengthOf.above(2)
234 expect(file.resolution).to.equal(720)
235 expect(file.resolutionLabel).to.equal('720p')
236 expect(file.size).to.equal(218910)
237
238 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 237 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
239 expect(test).to.equal(true) 238 expect(test).to.equal(true)
240 }) 239 })
@@ -289,14 +288,6 @@ describe('Test a single pod', function () {
289 expect(dateIsValid(video.createdAt)).to.be.true 288 expect(dateIsValid(video.createdAt)).to.be.true
290 expect(dateIsValid(video.updatedAt)).to.be.true 289 expect(dateIsValid(video.updatedAt)).to.be.true
291 290
292 expect(video.files).to.have.lengthOf(1)
293
294 const file = video.files[0]
295 expect(file.magnetUri).to.have.lengthOf.above(2)
296 expect(file.resolution).to.equal(720)
297 expect(file.resolutionLabel).to.equal('720p')
298 expect(file.size).to.equal(218910)
299
300 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 291 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
301 expect(test).to.equal(true) 292 expect(test).to.equal(true)
302 }) 293 })
@@ -493,10 +484,13 @@ describe('Test a single pod', function () {
493 484
494 it('Should search the right magnetUri video', async function () { 485 it('Should search the right magnetUri video', async function () {
495 const video = videosListBase[0] 486 const video = videosListBase[0]
496 const res = await searchVideoWithPagination(server.url, encodeURIComponent(video.files[0].magnetUri), 'magnetUri', 0, 15) 487 const res = await getVideo(server.url, video.id)
488 const videoDetails = res.body
497 489
498 const videos = res.body.data 490 const res2 = await searchVideoWithPagination(server.url, encodeURIComponent(videoDetails.files[0].magnetUri), 'magnetUri', 0, 15)
499 expect(res.body.total).to.equal(1) 491
492 const videos = res2.body.data
493 expect(res2.body.total).to.equal(1)
500 expect(videos.length).to.equal(1) 494 expect(videos.length).to.equal(1)
501 expect(videos[0].name).to.equal(video.name) 495 expect(videos[0].name).to.equal(video.name)
502 }) 496 })
@@ -566,6 +560,11 @@ describe('Test a single pod', function () {
566 expect(dateIsValid(video.createdAt)).to.be.true 560 expect(dateIsValid(video.createdAt)).to.be.true
567 expect(dateIsValid(video.updatedAt)).to.be.true 561 expect(dateIsValid(video.updatedAt)).to.be.true
568 562
563 expect(video.channel.name).to.equal('Default root channel')
564 expect(video.channel.isLocal).to.be.true
565 expect(dateIsValid(video.channel.createdAt)).to.be.true
566 expect(dateIsValid(video.channel.updatedAt)).to.be.true
567
569 expect(video.files).to.have.lengthOf(1) 568 expect(video.files).to.have.lengthOf(1)
570 569
571 const file = video.files[0] 570 const file = video.files[0]
@@ -610,6 +609,11 @@ describe('Test a single pod', function () {
610 expect(dateIsValid(video.createdAt)).to.be.true 609 expect(dateIsValid(video.createdAt)).to.be.true
611 expect(dateIsValid(video.updatedAt)).to.be.true 610 expect(dateIsValid(video.updatedAt)).to.be.true
612 611
612 expect(video.channel.name).to.equal('Default root channel')
613 expect(video.channel.isLocal).to.be.true
614 expect(dateIsValid(video.channel.createdAt)).to.be.true
615 expect(dateIsValid(video.channel.updatedAt)).to.be.true
616
613 expect(video.files).to.have.lengthOf(1) 617 expect(video.files).to.have.lengthOf(1)
614 618
615 const file = video.files[0] 619 const file = video.files[0]
@@ -645,6 +649,11 @@ describe('Test a single pod', function () {
645 expect(dateIsValid(video.createdAt)).to.be.true 649 expect(dateIsValid(video.createdAt)).to.be.true
646 expect(dateIsValid(video.updatedAt)).to.be.true 650 expect(dateIsValid(video.updatedAt)).to.be.true
647 651
652 expect(video.channel.name).to.equal('Default root channel')
653 expect(video.channel.isLocal).to.be.true
654 expect(dateIsValid(video.channel.createdAt)).to.be.true
655 expect(dateIsValid(video.channel.updatedAt)).to.be.true
656
648 expect(video.files).to.have.lengthOf(1) 657 expect(video.files).to.have.lengthOf(1)
649 658
650 const file = video.files[0] 659 const file = video.files[0]
diff --git a/server/tests/api/users.ts b/server/tests/api/users.ts
index 04c68d4ea..dbf0801f3 100644
--- a/server/tests/api/users.ts
+++ b/server/tests/api/users.ts
@@ -72,7 +72,7 @@ describe('Test users', function () {
72 }) 72 })
73 73
74 it('Should not login with an invalid password', async function () { 74 it('Should not login with an invalid password', async function () {
75 const user = { username: server.user.username, password: 'mewthree' } 75 const user = { username: server.user.username, password: 'mew_three' }
76 const res = await login(server.url, server.client, user, 400) 76 const res = await login(server.url, server.client, user, 400)
77 77
78 expect(res.body.error).to.equal('invalid_grant') 78 expect(res.body.error).to.equal('invalid_grant')
diff --git a/server/tests/api/video-channels.ts b/server/tests/api/video-channels.ts
new file mode 100644
index 000000000..95b202e2f
--- /dev/null
+++ b/server/tests/api/video-channels.ts
@@ -0,0 +1,141 @@
1/* tslint:disable:no-unused-expression */
2
3import { keyBy } from 'lodash'
4import { join } from 'path'
5import 'mocha'
6import * as chai from 'chai'
7const expect = chai.expect
8
9import {
10 ServerInfo,
11 flushTests,
12 runServer,
13 setAccessTokensToServers,
14 killallServers,
15 getMyUserInformation,
16 getVideoChannelsList,
17 addVideoChannel,
18 getAuthorVideoChannelsList,
19 updateVideoChannel,
20 deleteVideoChannel,
21 getVideoChannel
22} from '../utils'
23import { User } from '../../../shared'
24
25describe('Test a video channels', function () {
26 let server: ServerInfo
27 let userInfo: User
28 let videoChannelId: number
29
30 before(async function () {
31 this.timeout(120000)
32
33 await flushTests()
34
35 server = await runServer(1)
36
37 await setAccessTokensToServers([ server ])
38 })
39
40 it('Should have one video channel (created with root)', async () => {
41 const res = await getVideoChannelsList(server.url, 0, 2)
42
43 expect(res.body.total).to.equal(1)
44 expect(res.body.data).to.be.an('array')
45 expect(res.body.data).to.have.lengthOf(1)
46 })
47
48 it('Should create another video channel', async () => {
49 const videoChannel = {
50 name: 'second video channel',
51 description: 'super video channel description'
52 }
53 await addVideoChannel(server.url, server.accessToken, videoChannel)
54 })
55
56 it('Should have two video channels when getting my information', async () => {
57 const res = await getMyUserInformation(server.url, server.accessToken)
58 userInfo = res.body
59
60 expect(userInfo.videoChannels).to.be.an('array')
61 expect(userInfo.videoChannels).to.have.lengthOf(2)
62
63 const videoChannels = userInfo.videoChannels
64 expect(videoChannels[0].name).to.equal('Default root channel')
65 expect(videoChannels[1].name).to.equal('second video channel')
66 expect(videoChannels[1].description).to.equal('super video channel description')
67 })
68
69 it('Should have two video channels when getting author channels', async () => {
70 const res = await getAuthorVideoChannelsList(server.url, userInfo.author.uuid)
71
72 expect(res.body.total).to.equal(2)
73 expect(res.body.data).to.be.an('array')
74 expect(res.body.data).to.have.lengthOf(2)
75
76 const videoChannels = res.body.data
77 expect(videoChannels[0].name).to.equal('Default root channel')
78 expect(videoChannels[1].name).to.equal('second video channel')
79 expect(videoChannels[1].description).to.equal('super video channel description')
80
81 videoChannelId = videoChannels[1].id
82 })
83
84 it('Should list video channels', async () => {
85 const res = await getVideoChannelsList(server.url, 1, 1, '-name')
86
87 expect(res.body.total).to.equal(2)
88 expect(res.body.data).to.be.an('array')
89 expect(res.body.data).to.have.lengthOf(1)
90 expect(res.body.data[0].name).to.equal('Default root channel')
91 })
92
93 it('Should update video channel', async () => {
94 const videoChannelAttributes = {
95 name: 'video channel updated',
96 description: 'video channel description updated'
97 }
98
99 await updateVideoChannel(server.url, server.accessToken, videoChannelId, videoChannelAttributes)
100 })
101
102 it('Should have video channel updated', async () => {
103 const res = await getVideoChannelsList(server.url, 0, 1, '-name')
104
105 expect(res.body.total).to.equal(2)
106 expect(res.body.data).to.be.an('array')
107 expect(res.body.data).to.have.lengthOf(1)
108 expect(res.body.data[0].name).to.equal('video channel updated')
109 expect(res.body.data[0].description).to.equal('video channel description updated')
110 })
111
112 it('Should get video channel', async () => {
113 const res = await getVideoChannel(server.url, videoChannelId)
114
115 const videoChannel = res.body
116 expect(videoChannel.name).to.equal('video channel updated')
117 expect(videoChannel.description).to.equal('video channel description updated')
118 })
119
120 it('Should delete video channel', async () => {
121 await deleteVideoChannel(server.url, server.accessToken, videoChannelId)
122 })
123
124 it('Should have video channel deleted', async () => {
125 const res = await getVideoChannelsList(server.url, 0, 10)
126
127 expect(res.body.total).to.equal(1)
128 expect(res.body.data).to.be.an('array')
129 expect(res.body.data).to.have.lengthOf(1)
130 expect(res.body.data[0].name).to.equal('Default root channel')
131 })
132
133 after(async function () {
134 killallServers([ server ])
135
136 // Keep the logs if the test failed
137 if (this['ok']) {
138 await flushTests()
139 }
140 })
141})
diff --git a/server/tests/api/video-transcoder.ts b/server/tests/api/video-transcoder.ts
index 22d89724b..cafcc037d 100644
--- a/server/tests/api/video-transcoder.ts
+++ b/server/tests/api/video-transcoder.ts
@@ -13,7 +13,8 @@ import {
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 flushAndRunMultipleServers, 14 flushAndRunMultipleServers,
15 killallServers, 15 killallServers,
16 webtorrentAdd 16 webtorrentAdd,
17 getVideo
17} from '../utils' 18} from '../utils'
18 19
19describe('Test video transcoding', function () { 20describe('Test video transcoding', function () {
@@ -42,9 +43,12 @@ describe('Test video transcoding', function () {
42 43
43 const res = await getVideosList(servers[0].url) 44 const res = await getVideosList(servers[0].url)
44 const video = res.body.data[0] 45 const video = res.body.data[0]
45 expect(video.files).to.have.lengthOf(1)
46 46
47 const magnetUri = video.files[0].magnetUri 47 const res2 = await getVideo(servers[0].url, video.id)
48 const videoDetails = res2.body
49 expect(videoDetails.files).to.have.lengthOf(1)
50
51 const magnetUri = videoDetails.files[0].magnetUri
48 expect(magnetUri).to.match(/\.webm/) 52 expect(magnetUri).to.match(/\.webm/)
49 53
50 const torrent = await webtorrentAdd(magnetUri) 54 const torrent = await webtorrentAdd(magnetUri)
@@ -68,9 +72,12 @@ describe('Test video transcoding', function () {
68 const res = await getVideosList(servers[1].url) 72 const res = await getVideosList(servers[1].url)
69 73
70 const video = res.body.data[0] 74 const video = res.body.data[0]
71 expect(video.files).to.have.lengthOf(4) 75 const res2 = await getVideo(servers[1].url, video.id)
76 const videoDetails = res2.body
77
78 expect(videoDetails.files).to.have.lengthOf(4)
72 79
73 const magnetUri = video.files[0].magnetUri 80 const magnetUri = videoDetails.files[0].magnetUri
74 expect(magnetUri).to.match(/\.mp4/) 81 expect(magnetUri).to.match(/\.mp4/)
75 82
76 const torrent = await webtorrentAdd(magnetUri) 83 const torrent = await webtorrentAdd(magnetUri)