aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/videos.ts6
-rw-r--r--server/tests/api/server/follows.ts3
-rw-r--r--server/tests/api/server/handle-down.ts3
-rw-r--r--server/tests/api/users/user-subscriptions.ts28
-rw-r--r--server/tests/api/videos/multiple-servers.ts18
-rw-r--r--server/tests/api/videos/single-server.ts6
-rw-r--r--server/tests/utils/videos/videos.ts25
7 files changed, 59 insertions, 30 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 7fce8ba7c..904d22870 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -20,7 +20,7 @@ describe('Test videos API validator', function () {
20 let userAccessToken = '' 20 let userAccessToken = ''
21 let accountName: string 21 let accountName: string
22 let channelId: number 22 let channelId: number
23 let channelUUID: string 23 let channelName: string
24 let videoId 24 let videoId
25 25
26 // --------------------------------------------------------------- 26 // ---------------------------------------------------------------
@@ -42,7 +42,7 @@ describe('Test videos API validator', function () {
42 { 42 {
43 const res = await getMyUserInformation(server.url, server.accessToken) 43 const res = await getMyUserInformation(server.url, server.accessToken)
44 channelId = res.body.videoChannels[ 0 ].id 44 channelId = res.body.videoChannels[ 0 ].id
45 channelUUID = res.body.videoChannels[ 0 ].uuid 45 channelName = res.body.videoChannels[ 0 ].name
46 accountName = res.body.account.name + '@' + res.body.account.host 46 accountName = res.body.account.name + '@' + res.body.account.host
47 } 47 }
48 }) 48 })
@@ -140,7 +140,7 @@ describe('Test videos API validator', function () {
140 let path: string 140 let path: string
141 141
142 before(async function () { 142 before(async function () {
143 path = '/api/v1/video-channels/' + channelUUID + '/videos' 143 path = '/api/v1/video-channels/' + channelName + '/videos'
144 }) 144 })
145 145
146 it('Should fail with a bad start pagination', async function () { 146 it('Should fail with a bad start pagination', async function () {
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 243fcd4e7..310c291bf 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -311,7 +311,8 @@ describe('Test follows', function () {
311 likes: 1, 311 likes: 1,
312 dislikes: 1, 312 dislikes: 1,
313 channel: { 313 channel: {
314 name: 'Main root channel', 314 displayName: 'Main root channel',
315 name: 'root_channel',
315 description: '', 316 description: '',
316 isLocal 317 isLocal
317 }, 318 },
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index df35b36eb..ed15c8090 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -71,7 +71,8 @@ describe('Test handle downs', function () {
71 privacy: VideoPrivacy.PUBLIC, 71 privacy: VideoPrivacy.PUBLIC,
72 commentsEnabled: true, 72 commentsEnabled: true,
73 channel: { 73 channel: {
74 name: 'Main root channel', 74 name: 'root_channel',
75 displayName: 'Main root channel',
75 description: '', 76 description: '',
76 isLocal: false 77 isLocal: false
77 }, 78 },
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 2fbda6828..cb7d94b0b 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, userLogin } from '../../utils' 5import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, updateVideo, userLogin } from '../../utils'
6import { killallServers, ServerInfo, uploadVideo } from '../../utils/index' 6import { killallServers, ServerInfo, uploadVideo } from '../../utils/index'
7import { setAccessTokensToServers } from '../../utils/users/login' 7import { setAccessTokensToServers } from '../../utils/users/login'
8import { Video, VideoChannel } from '../../../../shared/models/videos' 8import { Video, VideoChannel } from '../../../../shared/models/videos'
@@ -20,6 +20,7 @@ const expect = chai.expect
20describe('Test users subscriptions', function () { 20describe('Test users subscriptions', function () {
21 let servers: ServerInfo[] = [] 21 let servers: ServerInfo[] = []
22 const users: { accessToken: string }[] = [] 22 const users: { accessToken: string }[] = []
23 let video3UUID: string
23 24
24 before(async function () { 25 before(async function () {
25 this.timeout(120000) 26 this.timeout(120000)
@@ -65,7 +66,8 @@ describe('Test users subscriptions', function () {
65 66
66 await waitJobs(servers) 67 await waitJobs(servers)
67 68
68 await uploadVideo(servers[2].url, users[2].accessToken, { name: 'video server 3 added after follow' }) 69 const res = await uploadVideo(servers[2].url, users[2].accessToken, { name: 'video server 3 added after follow' })
70 video3UUID = res.body.video.uuid
69 71
70 await waitJobs(servers) 72 await waitJobs(servers)
71 }) 73 })
@@ -247,7 +249,21 @@ describe('Test users subscriptions', function () {
247 } 249 }
248 }) 250 })
249 251
252 it('Should update a video of server 3 and see the updated video on server 1', async function () {
253 this.timeout(30000)
254
255 await updateVideo(servers[2].url, users[2].accessToken, video3UUID, { name: 'video server 3 added after follow updated' })
256
257 await waitJobs(servers)
258
259 const res = await listUserSubscriptionVideos(servers[0].url, users[0].accessToken, 'createdAt')
260 const videos: Video[] = res.body.data
261 expect(videos[2].name).to.equal('video server 3 added after follow updated')
262 })
263
250 it('Should remove user of server 3 subscription', async function () { 264 it('Should remove user of server 3 subscription', async function () {
265 this.timeout(30000)
266
251 await removeUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003') 267 await removeUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003')
252 268
253 await waitJobs(servers) 269 await waitJobs(servers)
@@ -267,6 +283,8 @@ describe('Test users subscriptions', function () {
267 }) 283 })
268 284
269 it('Should remove the root subscription and not display the videos anymore', async function () { 285 it('Should remove the root subscription and not display the videos anymore', async function () {
286 this.timeout(30000)
287
270 await removeUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:9001') 288 await removeUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:9001')
271 289
272 await waitJobs(servers) 290 await waitJobs(servers)
@@ -288,7 +306,7 @@ describe('Test users subscriptions', function () {
288 for (const video of res.body.data) { 306 for (const video of res.body.data) {
289 expect(video.name).to.not.contain('1-3') 307 expect(video.name).to.not.contain('1-3')
290 expect(video.name).to.not.contain('2-3') 308 expect(video.name).to.not.contain('2-3')
291 expect(video.name).to.not.contain('video server 3 added after follow') 309 expect(video.name).to.not.contain('video server 3 added after follow updated')
292 } 310 }
293 }) 311 })
294 312
@@ -309,7 +327,7 @@ describe('Test users subscriptions', function () {
309 327
310 expect(videos[0].name).to.equal('video 1-3') 328 expect(videos[0].name).to.equal('video 1-3')
311 expect(videos[1].name).to.equal('video 2-3') 329 expect(videos[1].name).to.equal('video 2-3')
312 expect(videos[2].name).to.equal('video server 3 added after follow') 330 expect(videos[2].name).to.equal('video server 3 added after follow updated')
313 } 331 }
314 332
315 { 333 {
@@ -319,7 +337,7 @@ describe('Test users subscriptions', function () {
319 for (const video of res.body.data) { 337 for (const video of res.body.data) {
320 expect(video.name).to.not.contain('1-3') 338 expect(video.name).to.not.contain('1-3')
321 expect(video.name).to.not.contain('2-3') 339 expect(video.name).to.not.contain('2-3')
322 expect(video.name).to.not.contain('video server 3 added after follow') 340 expect(video.name).to.not.contain('video server 3 added after follow updated')
323 } 341 }
324 } 342 }
325 }) 343 })
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 3c3839338..c551ccc59 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -128,7 +128,8 @@ describe('Test multiple servers', function () {
128 privacy: VideoPrivacy.PUBLIC, 128 privacy: VideoPrivacy.PUBLIC,
129 commentsEnabled: true, 129 commentsEnabled: true,
130 channel: { 130 channel: {
131 name: 'my channel', 131 displayName: 'my channel',
132 name: 'super_channel_name',
132 description: 'super channel', 133 description: 'super channel',
133 isLocal 134 isLocal
134 }, 135 },
@@ -201,7 +202,8 @@ describe('Test multiple servers', function () {
201 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], 202 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
202 privacy: VideoPrivacy.PUBLIC, 203 privacy: VideoPrivacy.PUBLIC,
203 channel: { 204 channel: {
204 name: 'Main user1 channel', 205 displayName: 'Main user1 channel',
206 name: 'user1_channel',
205 description: 'super channel', 207 description: 'super channel',
206 isLocal 208 isLocal
207 }, 209 },
@@ -307,7 +309,8 @@ describe('Test multiple servers', function () {
307 tags: [ 'tag1p3' ], 309 tags: [ 'tag1p3' ],
308 privacy: VideoPrivacy.PUBLIC, 310 privacy: VideoPrivacy.PUBLIC,
309 channel: { 311 channel: {
310 name: 'Main root channel', 312 displayName: 'Main root channel',
313 name: 'root_channel',
311 description: '', 314 description: '',
312 isLocal 315 isLocal
313 }, 316 },
@@ -339,7 +342,8 @@ describe('Test multiple servers', function () {
339 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], 342 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
340 privacy: VideoPrivacy.PUBLIC, 343 privacy: VideoPrivacy.PUBLIC,
341 channel: { 344 channel: {
342 name: 'Main root channel', 345 displayName: 'Main root channel',
346 name: 'root_channel',
343 description: '', 347 description: '',
344 isLocal 348 isLocal
345 }, 349 },
@@ -647,7 +651,8 @@ describe('Test multiple servers', function () {
647 tags: [ 'tag_up_1', 'tag_up_2' ], 651 tags: [ 'tag_up_1', 'tag_up_2' ],
648 privacy: VideoPrivacy.PUBLIC, 652 privacy: VideoPrivacy.PUBLIC,
649 channel: { 653 channel: {
650 name: 'Main root channel', 654 displayName: 'Main root channel',
655 name: 'root_channel',
651 description: '', 656 description: '',
652 isLocal 657 isLocal
653 }, 658 },
@@ -967,7 +972,8 @@ describe('Test multiple servers', function () {
967 tags: [ ], 972 tags: [ ],
968 privacy: VideoPrivacy.PUBLIC, 973 privacy: VideoPrivacy.PUBLIC,
969 channel: { 974 channel: {
970 name: 'Main root channel', 975 displayName: 'Main root channel',
976 name: 'root_channel',
971 description: '', 977 description: '',
972 isLocal 978 isLocal
973 }, 979 },
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 12181ad67..a757ad9da 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -56,7 +56,8 @@ describe('Test a single server', function () {
56 privacy: VideoPrivacy.PUBLIC, 56 privacy: VideoPrivacy.PUBLIC,
57 commentsEnabled: true, 57 commentsEnabled: true,
58 channel: { 58 channel: {
59 name: 'Main root channel', 59 displayName: 'Main root channel',
60 name: 'root_channel',
60 description: '', 61 description: '',
61 isLocal: true 62 isLocal: true
62 }, 63 },
@@ -87,7 +88,8 @@ describe('Test a single server', function () {
87 duration: 5, 88 duration: 5,
88 commentsEnabled: false, 89 commentsEnabled: false,
89 channel: { 90 channel: {
90 name: 'Main root channel', 91 name: 'root_channel',
92 displayName: 'Main root channel',
91 description: '', 93 description: '',
92 isLocal: true 94 isLocal: true
93 }, 95 },
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 592248144..674a92df9 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -438,18 +438,19 @@ async function completeVideoCheck (
438 name: string 438 name: string
439 host: string 439 host: string
440 } 440 }
441 isLocal: boolean, 441 isLocal: boolean
442 tags: string[], 442 tags: string[]
443 privacy: number, 443 privacy: number
444 likes?: number, 444 likes?: number
445 dislikes?: number, 445 dislikes?: number
446 duration: number, 446 duration: number
447 channel: { 447 channel: {
448 name: string, 448 displayName: string
449 name: string
449 description 450 description
450 isLocal: boolean 451 isLocal: boolean
451 } 452 }
452 fixture: string, 453 fixture: string
453 files: { 454 files: {
454 resolution: number 455 resolution: number
455 size: number 456 size: number
@@ -476,8 +477,8 @@ async function completeVideoCheck (
476 expect(video.account.uuid).to.be.a('string') 477 expect(video.account.uuid).to.be.a('string')
477 expect(video.account.host).to.equal(attributes.account.host) 478 expect(video.account.host).to.equal(attributes.account.host)
478 expect(video.account.name).to.equal(attributes.account.name) 479 expect(video.account.name).to.equal(attributes.account.name)
479 expect(video.channel.displayName).to.equal(attributes.channel.name) 480 expect(video.channel.displayName).to.equal(attributes.channel.displayName)
480 expect(video.channel.name).to.have.lengthOf(36) 481 expect(video.channel.name).to.equal(attributes.channel.name)
481 expect(video.likes).to.equal(attributes.likes) 482 expect(video.likes).to.equal(attributes.likes)
482 expect(video.dislikes).to.equal(attributes.dislikes) 483 expect(video.dislikes).to.equal(attributes.dislikes)
483 expect(video.isLocal).to.equal(attributes.isLocal) 484 expect(video.isLocal).to.equal(attributes.isLocal)
@@ -497,8 +498,8 @@ async function completeVideoCheck (
497 expect(videoDetails.tags).to.deep.equal(attributes.tags) 498 expect(videoDetails.tags).to.deep.equal(attributes.tags)
498 expect(videoDetails.account.name).to.equal(attributes.account.name) 499 expect(videoDetails.account.name).to.equal(attributes.account.name)
499 expect(videoDetails.account.host).to.equal(attributes.account.host) 500 expect(videoDetails.account.host).to.equal(attributes.account.host)
500 expect(videoDetails.channel.displayName).to.equal(attributes.channel.name) 501 expect(video.channel.displayName).to.equal(attributes.channel.displayName)
501 expect(videoDetails.channel.name).to.have.lengthOf(36) 502 expect(video.channel.name).to.equal(attributes.channel.name)
502 expect(videoDetails.channel.host).to.equal(attributes.account.host) 503 expect(videoDetails.channel.host).to.equal(attributes.account.host)
503 expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal) 504 expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal)
504 expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true 505 expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true