]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/users/user-subscriptions.ts
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / server / tests / api / users / user-subscriptions.ts
CommitLineData
a1587156 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
06a05d5f 2
86347717 3import { expect } from 'chai'
6def7d34 4import { VideoPrivacy } from '@shared/models'
9639bd17 5import {
7c3b7976 6 cleanupTests,
254d3579 7 createMultipleServers,
4c7e60bc 8 doubleFollow,
254d3579 9 PeerTubeServer,
c3d29f69 10 setAccessTokensToServers,
d0800f76 11 setDefaultAccountAvatar,
12 setDefaultChannelAvatar,
2c27e704 13 SubscriptionsCommand,
c3d29f69 14 waitJobs
bf54587a 15} from '@shared/server-commands'
06a05d5f 16
06a05d5f 17describe('Test users subscriptions', function () {
254d3579 18 let servers: PeerTubeServer[] = []
8a19bee1 19 const users: { accessToken: string }[] = []
f6eebcb3 20 let video3UUID: string
06a05d5f 21
2c27e704
C
22 let command: SubscriptionsCommand
23
06a05d5f 24 before(async function () {
87c0f718 25 this.timeout(240000)
06a05d5f 26
254d3579 27 servers = await createMultipleServers(3)
06a05d5f
C
28
29 // Get the access tokens
30 await setAccessTokensToServers(servers)
d0800f76 31 await setDefaultChannelAvatar(servers)
32 await setDefaultAccountAvatar(servers)
06a05d5f
C
33
34 // Server 1 and server 2 follow each other
35 await doubleFollow(servers[0], servers[1])
36
6def7d34
C
37 for (const server of servers) {
38 const user = { username: 'user' + server.serverNumber, password: 'password' }
39 await server.users.create({ username: user.username, password: user.password })
06a05d5f 40
6def7d34
C
41 const accessToken = await server.login.getAccessToken(user)
42 users.push({ accessToken })
06a05d5f 43
6def7d34
C
44 const videoName1 = 'video 1-' + server.serverNumber
45 await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } })
06a05d5f 46
6def7d34
C
47 const videoName2 = 'video 2-' + server.serverNumber
48 await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } })
06a05d5f
C
49 }
50
51 await waitJobs(servers)
2c27e704 52
89d241a7 53 command = servers[0].subscriptions
06a05d5f
C
54 })
55
a6b26afc
C
56 describe('Destinction between server videos and user videos', function () {
57 it('Should display videos of server 2 on server 1', async function () {
58 const { total } = await servers[0].videos.list()
06a05d5f 59
a6b26afc
C
60 expect(total).to.equal(4)
61 })
06a05d5f 62
a6b26afc
C
63 it('User of server 1 should follow user of server 3 and root of server 1', async function () {
64 this.timeout(60000)
06a05d5f 65
2732eeff
C
66 await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })
67 await command.add({ token: users[0].accessToken, targetUri: 'root_channel@' + servers[0].host })
06a05d5f 68
a6b26afc 69 await waitJobs(servers)
06a05d5f 70
a6b26afc
C
71 const attributes = { name: 'video server 3 added after follow' }
72 const { uuid } = await servers[2].videos.upload({ token: users[2].accessToken, attributes })
73 video3UUID = uuid
06a05d5f 74
a6b26afc
C
75 await waitJobs(servers)
76 })
06a05d5f 77
a6b26afc
C
78 it('Should not display videos of server 3 on server 1', async function () {
79 const { total, data } = await servers[0].videos.list()
80 expect(total).to.equal(4)
06a05d5f 81
a6b26afc
C
82 for (const video of data) {
83 expect(video.name).to.not.contain('1-3')
84 expect(video.name).to.not.contain('2-3')
85 expect(video.name).to.not.contain('video server 3 added after follow')
86 }
87 })
06a05d5f
C
88 })
89
a6b26afc 90 describe('Subscription endpoints', function () {
06a05d5f 91
a6b26afc
C
92 it('Should list subscriptions', async function () {
93 {
94 const body = await command.list()
95 expect(body.total).to.equal(0)
96 expect(body.data).to.be.an('array')
97 expect(body.data).to.have.lengthOf(0)
98 }
06a05d5f 99
a6b26afc
C
100 {
101 const body = await command.list({ token: users[0].accessToken, sort: 'createdAt' })
102 expect(body.total).to.equal(2)
06a05d5f 103
a6b26afc
C
104 const subscriptions = body.data
105 expect(subscriptions).to.be.an('array')
106 expect(subscriptions).to.have.lengthOf(2)
99492dbc 107
a6b26afc
C
108 expect(subscriptions[0].name).to.equal('user3_channel')
109 expect(subscriptions[1].name).to.equal('root_channel')
110 }
111 })
99492dbc 112
a6b26afc
C
113 it('Should get subscription', async function () {
114 {
2732eeff 115 const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })
99492dbc 116
a6b26afc 117 expect(videoChannel.name).to.equal('user3_channel')
2732eeff 118 expect(videoChannel.host).to.equal(servers[2].host)
a6b26afc
C
119 expect(videoChannel.displayName).to.equal('Main user3 channel')
120 expect(videoChannel.followingCount).to.equal(0)
121 expect(videoChannel.followersCount).to.equal(1)
122 }
99492dbc 123
a6b26afc 124 {
2732eeff 125 const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })
f37dc0dd 126
a6b26afc 127 expect(videoChannel.name).to.equal('root_channel')
2732eeff 128 expect(videoChannel.host).to.equal(servers[0].host)
a6b26afc
C
129 expect(videoChannel.displayName).to.equal('Main root channel')
130 expect(videoChannel.followingCount).to.equal(0)
131 expect(videoChannel.followersCount).to.equal(1)
132 }
133 })
134
135 it('Should return the existing subscriptions', async function () {
136 const uris = [
2732eeff
C
137 'user3_channel@' + servers[2].host,
138 'root2_channel@' + servers[0].host,
139 'root_channel@' + servers[0].host,
140 'user3_channel@' + servers[0].host
a6b26afc
C
141 ]
142
143 const body = await command.exist({ token: users[0].accessToken, uris })
144
2732eeff
C
145 expect(body['user3_channel@' + servers[2].host]).to.be.true
146 expect(body['root2_channel@' + servers[0].host]).to.be.false
147 expect(body['root_channel@' + servers[0].host]).to.be.true
148 expect(body['user3_channel@' + servers[0].host]).to.be.false
a6b26afc
C
149 })
150
151 it('Should search among subscriptions', async function () {
152 {
153 const body = await command.list({ token: users[0].accessToken, sort: '-createdAt', search: 'user3_channel' })
154 expect(body.total).to.equal(1)
155 expect(body.data).to.have.lengthOf(1)
156 }
f37dc0dd 157
a6b26afc
C
158 {
159 const body = await command.list({ token: users[0].accessToken, sort: '-createdAt', search: 'toto' })
160 expect(body.total).to.equal(0)
161 expect(body.data).to.have.lengthOf(0)
162 }
163 })
f37dc0dd
C
164 })
165
a6b26afc 166 describe('Subscription videos', function () {
7b390964 167
a6b26afc
C
168 it('Should list subscription videos', async function () {
169 {
692ae8c3 170 const body = await servers[0].videos.listMySubscriptionVideos()
a6b26afc
C
171 expect(body.total).to.equal(0)
172 expect(body.data).to.be.an('array')
173 expect(body.data).to.have.lengthOf(0)
174 }
06a05d5f 175
a6b26afc 176 {
692ae8c3 177 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, sort: 'createdAt' })
a6b26afc 178 expect(body.total).to.equal(3)
06a05d5f 179
a6b26afc
C
180 const videos = body.data
181 expect(videos).to.be.an('array')
182 expect(videos).to.have.lengthOf(3)
06a05d5f 183
a6b26afc
C
184 expect(videos[0].name).to.equal('video 1-3')
185 expect(videos[1].name).to.equal('video 2-3')
186 expect(videos[2].name).to.equal('video server 3 added after follow')
187 }
692ae8c3
W
188
189 {
190 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, count: 1, start: 1 })
191 expect(body.total).to.equal(3)
192
193 const videos = body.data
194 expect(videos).to.be.an('array')
195 expect(videos).to.have.lengthOf(1)
196
197 expect(videos[0].name).to.equal('video 2-3')
198 }
a6b26afc 199 })
06a05d5f 200
a6b26afc
C
201 it('Should upload a video by root on server 1 and see it in the subscription videos', async function () {
202 this.timeout(60000)
06a05d5f 203
a6b26afc
C
204 const videoName = 'video server 1 added after follow'
205 await servers[0].videos.upload({ attributes: { name: videoName } })
06a05d5f 206
a6b26afc 207 await waitJobs(servers)
06a05d5f 208
a6b26afc 209 {
692ae8c3 210 const body = await servers[0].videos.listMySubscriptionVideos()
a6b26afc
C
211 expect(body.total).to.equal(0)
212 expect(body.data).to.be.an('array')
213 expect(body.data).to.have.lengthOf(0)
214 }
06a05d5f 215
a6b26afc 216 {
692ae8c3 217 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, sort: 'createdAt' })
a6b26afc 218 expect(body.total).to.equal(4)
06a05d5f 219
a6b26afc
C
220 const videos = body.data
221 expect(videos).to.be.an('array')
222 expect(videos).to.have.lengthOf(4)
06a05d5f 223
a6b26afc
C
224 expect(videos[0].name).to.equal('video 1-3')
225 expect(videos[1].name).to.equal('video 2-3')
226 expect(videos[2].name).to.equal('video server 3 added after follow')
227 expect(videos[3].name).to.equal('video server 1 added after follow')
228 }
06a05d5f 229
a6b26afc
C
230 {
231 const { data, total } = await servers[0].videos.list()
232 expect(total).to.equal(5)
06a05d5f 233
a6b26afc
C
234 for (const video of data) {
235 expect(video.name).to.not.contain('1-3')
236 expect(video.name).to.not.contain('2-3')
237 expect(video.name).to.not.contain('video server 3 added after follow')
238 }
06a05d5f 239 }
a6b26afc 240 })
06a05d5f 241
a6b26afc
C
242 it('Should have server 1 following server 3 and display server 3 videos', async function () {
243 this.timeout(60000)
06a05d5f 244
a6b26afc 245 await servers[0].follows.follow({ hosts: [ servers[2].url ] })
06a05d5f 246
a6b26afc 247 await waitJobs(servers)
06a05d5f 248
a6b26afc
C
249 const { data, total } = await servers[0].videos.list()
250 expect(total).to.equal(8)
06a05d5f 251
a6b26afc
C
252 const names = [ '1-3', '2-3', 'video server 3 added after follow' ]
253 for (const name of names) {
254 const video = data.find(v => v.name.includes(name))
255 expect(video).to.not.be.undefined
256 }
257 })
06a05d5f 258
a6b26afc
C
259 it('Should remove follow server 1 -> server 3 and hide server 3 videos', async function () {
260 this.timeout(60000)
06a05d5f 261
a6b26afc 262 await servers[0].follows.unfollow({ target: servers[2] })
06a05d5f 263
a6b26afc 264 await waitJobs(servers)
06a05d5f 265
a6b26afc
C
266 const { total, data } = await servers[0].videos.list()
267 expect(total).to.equal(5)
06a05d5f 268
a6b26afc
C
269 for (const video of data) {
270 expect(video.name).to.not.contain('1-3')
271 expect(video.name).to.not.contain('2-3')
272 expect(video.name).to.not.contain('video server 3 added after follow')
273 }
274 })
275
276 it('Should still list subscription videos', async function () {
277 {
692ae8c3 278 const body = await servers[0].videos.listMySubscriptionVideos()
a6b26afc
C
279 expect(body.total).to.equal(0)
280 expect(body.data).to.be.an('array')
281 expect(body.data).to.have.lengthOf(0)
282 }
06a05d5f 283
a6b26afc 284 {
692ae8c3 285 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, sort: 'createdAt' })
a6b26afc 286 expect(body.total).to.equal(4)
06a05d5f 287
a6b26afc
C
288 const videos = body.data
289 expect(videos).to.be.an('array')
290 expect(videos).to.have.lengthOf(4)
06a05d5f 291
a6b26afc
C
292 expect(videos[0].name).to.equal('video 1-3')
293 expect(videos[1].name).to.equal('video 2-3')
294 expect(videos[2].name).to.equal('video server 3 added after follow')
295 expect(videos[3].name).to.equal('video server 1 added after follow')
296 }
297 })
06a05d5f
C
298 })
299
a6b26afc 300 describe('Existing subscription video update', function () {
f6eebcb3 301
a6b26afc
C
302 it('Should update a video of server 3 and see the updated video on server 1', async function () {
303 this.timeout(30000)
f6eebcb3 304
a6b26afc 305 await servers[2].videos.update({ id: video3UUID, attributes: { name: 'video server 3 added after follow updated' } })
f6eebcb3 306
a6b26afc 307 await waitJobs(servers)
06a05d5f 308
692ae8c3 309 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, sort: 'createdAt' })
a6b26afc
C
310 expect(body.data[2].name).to.equal('video server 3 added after follow updated')
311 })
06a05d5f
C
312 })
313
a6b26afc 314 describe('Subscription removal', function () {
06a05d5f 315
a6b26afc
C
316 it('Should remove user of server 3 subscription', async function () {
317 this.timeout(30000)
06a05d5f 318
2732eeff 319 await command.remove({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })
f6eebcb3 320
a6b26afc
C
321 await waitJobs(servers)
322 })
06a05d5f 323
a6b26afc 324 it('Should not display its videos anymore', async function () {
692ae8c3 325 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, sort: 'createdAt' })
a6b26afc 326 expect(body.total).to.equal(1)
06a05d5f 327
2c27e704 328 const videos = body.data
06a05d5f 329 expect(videos).to.be.an('array')
a6b26afc 330 expect(videos).to.have.lengthOf(1)
06a05d5f 331
a6b26afc
C
332 expect(videos[0].name).to.equal('video server 1 added after follow')
333 })
06a05d5f 334
a6b26afc
C
335 it('Should remove the root subscription and not display the videos anymore', async function () {
336 this.timeout(30000)
06a05d5f 337
2732eeff 338 await command.remove({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })
06a05d5f 339
a6b26afc 340 await waitJobs(servers)
06a05d5f 341
a6b26afc
C
342 {
343 const body = await command.list({ token: users[0].accessToken, sort: 'createdAt' })
344 expect(body.total).to.equal(0)
06a05d5f 345
a6b26afc
C
346 const videos = body.data
347 expect(videos).to.be.an('array')
348 expect(videos).to.have.lengthOf(0)
349 }
350 })
06a05d5f 351
a6b26afc 352 it('Should correctly display public videos on server 1', async function () {
89d241a7 353 const { total, data } = await servers[0].videos.list()
d23dd9fb 354 expect(total).to.equal(5)
06a05d5f 355
d23dd9fb 356 for (const video of data) {
06a05d5f
C
357 expect(video.name).to.not.contain('1-3')
358 expect(video.name).to.not.contain('2-3')
f6eebcb3 359 expect(video.name).to.not.contain('video server 3 added after follow updated')
06a05d5f 360 }
a6b26afc 361 })
06a05d5f
C
362 })
363
a6b26afc 364 describe('Re-follow', function () {
4beda9e1 365
a6b26afc
C
366 it('Should follow user of server 3 again', async function () {
367 this.timeout(60000)
4beda9e1 368
2732eeff 369 await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })
4beda9e1 370
a6b26afc 371 await waitJobs(servers)
4beda9e1 372
a6b26afc 373 {
692ae8c3 374 const body = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken, sort: 'createdAt' })
a6b26afc 375 expect(body.total).to.equal(3)
4beda9e1 376
a6b26afc
C
377 const videos = body.data
378 expect(videos).to.be.an('array')
379 expect(videos).to.have.lengthOf(3)
4beda9e1 380
a6b26afc
C
381 expect(videos[0].name).to.equal('video 1-3')
382 expect(videos[1].name).to.equal('video 2-3')
383 expect(videos[2].name).to.equal('video server 3 added after follow updated')
384 }
4beda9e1 385
a6b26afc
C
386 {
387 const { total, data } = await servers[0].videos.list()
388 expect(total).to.equal(5)
4beda9e1 389
a6b26afc
C
390 for (const video of data) {
391 expect(video.name).to.not.contain('1-3')
392 expect(video.name).to.not.contain('2-3')
393 expect(video.name).to.not.contain('video server 3 added after follow updated')
394 }
395 }
396 })
4beda9e1 397
a6b26afc
C
398 it('Should follow user channels of server 3 by root of server 3', async function () {
399 this.timeout(60000)
4beda9e1 400
a6b26afc 401 await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } })
4beda9e1 402
2732eeff
C
403 await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@' + servers[2].host })
404 await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@' + servers[2].host })
a6b26afc
C
405
406 await waitJobs(servers)
407 })
4beda9e1
C
408 })
409
a6b26afc
C
410 describe('Followers listing', function () {
411
412 it('Should list user 3 followers', async function () {
413 {
414 const { total, data } = await servers[2].accounts.listFollowers({
415 token: users[2].accessToken,
416 accountName: 'user3',
417 start: 0,
418 count: 5,
419 sort: 'createdAt'
420 })
421
422 expect(total).to.equal(3)
423 expect(data).to.have.lengthOf(3)
424
425 expect(data[0].following.host).to.equal(servers[2].host)
426 expect(data[0].following.name).to.equal('user3_channel')
427 expect(data[0].follower.host).to.equal(servers[0].host)
428 expect(data[0].follower.name).to.equal('user1')
429
430 expect(data[1].following.host).to.equal(servers[2].host)
431 expect(data[1].following.name).to.equal('user3_channel')
432 expect(data[1].follower.host).to.equal(servers[2].host)
433 expect(data[1].follower.name).to.equal('root')
434
435 expect(data[2].following.host).to.equal(servers[2].host)
436 expect(data[2].following.name).to.equal('user3_channel2')
437 expect(data[2].follower.host).to.equal(servers[2].host)
438 expect(data[2].follower.name).to.equal('root')
439 }
6def7d34 440
a6b26afc
C
441 {
442 const { total, data } = await servers[2].accounts.listFollowers({
443 token: users[2].accessToken,
444 accountName: 'user3',
445 start: 0,
446 count: 1,
447 sort: '-createdAt'
448 })
449
450 expect(total).to.equal(3)
451 expect(data).to.have.lengthOf(1)
452
453 expect(data[0].following.host).to.equal(servers[2].host)
454 expect(data[0].following.name).to.equal('user3_channel2')
455 expect(data[0].follower.host).to.equal(servers[2].host)
456 expect(data[0].follower.name).to.equal('root')
457 }
6def7d34 458
a6b26afc
C
459 {
460 const { total, data } = await servers[2].accounts.listFollowers({
461 token: users[2].accessToken,
462 accountName: 'user3',
463 start: 1,
464 count: 1,
465 sort: '-createdAt'
466 })
467
468 expect(total).to.equal(3)
469 expect(data).to.have.lengthOf(1)
470
471 expect(data[0].following.host).to.equal(servers[2].host)
472 expect(data[0].following.name).to.equal('user3_channel')
473 expect(data[0].follower.host).to.equal(servers[2].host)
474 expect(data[0].follower.name).to.equal('root')
475 }
6def7d34 476
a6b26afc
C
477 {
478 const { total, data } = await servers[2].accounts.listFollowers({
479 token: users[2].accessToken,
480 accountName: 'user3',
481 search: 'user1',
482 sort: '-createdAt'
483 })
484
485 expect(total).to.equal(1)
486 expect(data).to.have.lengthOf(1)
487
488 expect(data[0].following.host).to.equal(servers[2].host)
489 expect(data[0].following.name).to.equal('user3_channel')
490 expect(data[0].follower.host).to.equal(servers[0].host)
491 expect(data[0].follower.name).to.equal('user1')
492 }
493 })
494
495 it('Should list user3_channel followers', async function () {
496 {
497 const { total, data } = await servers[2].channels.listFollowers({
498 token: users[2].accessToken,
499 channelName: 'user3_channel',
500 start: 0,
501 count: 5,
502 sort: 'createdAt'
503 })
504
505 expect(total).to.equal(2)
506 expect(data).to.have.lengthOf(2)
507
508 expect(data[0].following.host).to.equal(servers[2].host)
509 expect(data[0].following.name).to.equal('user3_channel')
510 expect(data[0].follower.host).to.equal(servers[0].host)
511 expect(data[0].follower.name).to.equal('user1')
512
513 expect(data[1].following.host).to.equal(servers[2].host)
514 expect(data[1].following.name).to.equal('user3_channel')
515 expect(data[1].follower.host).to.equal(servers[2].host)
516 expect(data[1].follower.name).to.equal('root')
517 }
518
519 {
520 const { total, data } = await servers[2].channels.listFollowers({
521 token: users[2].accessToken,
522 channelName: 'user3_channel',
523 start: 0,
524 count: 1,
525 sort: '-createdAt'
526 })
527
528 expect(total).to.equal(2)
529 expect(data).to.have.lengthOf(1)
530
531 expect(data[0].following.host).to.equal(servers[2].host)
532 expect(data[0].following.name).to.equal('user3_channel')
533 expect(data[0].follower.host).to.equal(servers[2].host)
534 expect(data[0].follower.name).to.equal('root')
535 }
536
537 {
538 const { total, data } = await servers[2].channels.listFollowers({
539 token: users[2].accessToken,
540 channelName: 'user3_channel',
541 start: 1,
542 count: 1,
543 sort: '-createdAt'
544 })
545
546 expect(total).to.equal(2)
547 expect(data).to.have.lengthOf(1)
548
549 expect(data[0].following.host).to.equal(servers[2].host)
550 expect(data[0].following.name).to.equal('user3_channel')
551 expect(data[0].follower.host).to.equal(servers[0].host)
552 expect(data[0].follower.name).to.equal('user1')
553 }
554
555 {
556 const { total, data } = await servers[2].channels.listFollowers({
557 token: users[2].accessToken,
558 channelName: 'user3_channel',
559 search: 'user1',
560 sort: '-createdAt'
561 })
562
563 expect(total).to.equal(1)
564 expect(data).to.have.lengthOf(1)
565
566 expect(data[0].following.host).to.equal(servers[2].host)
567 expect(data[0].following.name).to.equal('user3_channel')
568 expect(data[0].follower.host).to.equal(servers[0].host)
569 expect(data[0].follower.name).to.equal('user1')
570 }
571 })
6def7d34
C
572 })
573
a6b26afc 574 describe('Subscription videos privacy', function () {
6def7d34 575
a6b26afc
C
576 it('Should update video as internal and not see from remote server', async function () {
577 this.timeout(30000)
6def7d34 578
a6b26afc
C
579 await servers[2].videos.update({ id: video3UUID, attributes: { name: 'internal', privacy: VideoPrivacy.INTERNAL } })
580 await waitJobs(servers)
6def7d34 581
a6b26afc 582 {
692ae8c3 583 const { data } = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken })
a6b26afc
C
584 expect(data.find(v => v.name === 'internal')).to.not.exist
585 }
586 })
587
588 it('Should see internal from local user', async function () {
692ae8c3 589 const { data } = await servers[2].videos.listMySubscriptionVideos({ token: servers[2].accessToken })
a6b26afc
C
590 expect(data.find(v => v.name === 'internal')).to.exist
591 })
592
593 it('Should update video as private and not see from anyone server', async function () {
594 this.timeout(30000)
595
596 await servers[2].videos.update({ id: video3UUID, attributes: { name: 'private', privacy: VideoPrivacy.PRIVATE } })
597 await waitJobs(servers)
598
599 {
692ae8c3 600 const { data } = await servers[0].videos.listMySubscriptionVideos({ token: users[0].accessToken })
a6b26afc
C
601 expect(data.find(v => v.name === 'private')).to.not.exist
602 }
603
604 {
692ae8c3 605 const { data } = await servers[2].videos.listMySubscriptionVideos({ token: servers[2].accessToken })
a6b26afc
C
606 expect(data.find(v => v.name === 'private')).to.not.exist
607 }
608 })
6def7d34
C
609 })
610
7c3b7976
C
611 after(async function () {
612 await cleanupTests(servers)
06a05d5f
C
613 })
614})