+ await createVideoPlaylist({
+ url: servers[0].url,
+ token: servers[0].accessToken,
+ playlistAttrs: {
+ displayName: 'my super playlist',
+ privacy: VideoPlaylistPrivacy.PUBLIC,
+ description: 'my super description',
+ thumbnailfile: 'thumbnail.jpg',
+ videoChannelId: servers[0].videoChannel.id
+ }
+ })
+
+ await waitJobs(servers)
+ // Processing a playlist by the receiver could be long
+ await wait(3000)
+
+ for (const server of servers) {
+ const res = await getVideoPlaylistsList(server.url, 0, 5)
+ expect(res.body.total).to.equal(1)
+ expect(res.body.data).to.have.lengthOf(1)
+
+ const playlistFromList = res.body.data[0] as VideoPlaylist
+
+ const res2 = await getVideoPlaylist(server.url, playlistFromList.uuid)
+ const playlistFromGet = res2.body as VideoPlaylist
+
+ for (const playlist of [ playlistFromGet, playlistFromList ]) {
+ expect(playlist.id).to.be.a('number')
+ expect(playlist.uuid).to.be.a('string')
+
+ expect(playlist.isLocal).to.equal(server.serverNumber === 1)
+
+ expect(playlist.displayName).to.equal('my super playlist')
+ expect(playlist.description).to.equal('my super description')
+ expect(playlist.privacy.id).to.equal(VideoPlaylistPrivacy.PUBLIC)
+ expect(playlist.privacy.label).to.equal('Public')
+ expect(playlist.type.id).to.equal(VideoPlaylistType.REGULAR)
+ expect(playlist.type.label).to.equal('Regular')
+ expect(playlist.embedPath).to.equal('/video-playlists/embed/' + playlist.uuid)
+
+ expect(playlist.videosLength).to.equal(0)
+
+ expect(playlist.ownerAccount.name).to.equal('root')
+ expect(playlist.ownerAccount.displayName).to.equal('root')
+ expect(playlist.videoChannel.name).to.equal('root_channel')
+ expect(playlist.videoChannel.displayName).to.equal('Main root channel')
+ }
+ }
+ })
+
+ it('Should create a playlist on server 2 and have the playlist on server 1 but not on server 3', async function () {
+ this.timeout(30000)
+
+ {
+ const res = await createVideoPlaylist({
+ url: servers[1].url,
+ token: servers[1].accessToken,
+ playlistAttrs: {
+ displayName: 'playlist 2',
+ privacy: VideoPlaylistPrivacy.PUBLIC,
+ videoChannelId: servers[1].videoChannel.id
+ }
+ })
+ playlistServer2Id1 = res.body.videoPlaylist.id
+ }
+
+ {
+ const res = await createVideoPlaylist({
+ url: servers[1].url,
+ token: servers[1].accessToken,
+ playlistAttrs: {
+ displayName: 'playlist 3',
+ privacy: VideoPlaylistPrivacy.PUBLIC,
+ thumbnailfile: 'thumbnail.jpg',
+ videoChannelId: servers[1].videoChannel.id
+ }
+ })
+
+ playlistServer2Id2 = res.body.videoPlaylist.id
+ playlistServer2UUID2 = res.body.videoPlaylist.uuid
+ }
+
+ for (const id of [ playlistServer2Id1, playlistServer2Id2 ]) {
+ await addVideoInPlaylist({
+ url: servers[1].url,
+ token: servers[1].accessToken,
+ playlistId: id,
+ elementAttrs: { videoId: servers[1].videos[0].id, startTimestamp: 1, stopTimestamp: 2 }
+ })
+ await addVideoInPlaylist({
+ url: servers[1].url,
+ token: servers[1].accessToken,
+ playlistId: id,
+ elementAttrs: { videoId: servers[1].videos[1].id }
+ })
+ }
+
+ await waitJobs(servers)
+ await wait(3000)
+
+ for (const server of [ servers[0], servers[1] ]) {
+ const res = await getVideoPlaylistsList(server.url, 0, 5)
+
+ const playlist2 = res.body.data.find(p => p.displayName === 'playlist 2')
+ expect(playlist2).to.not.be.undefined
+ await testImage(server.url, 'thumbnail-playlist', playlist2.thumbnailPath)
+
+ const playlist3 = res.body.data.find(p => p.displayName === 'playlist 3')
+ expect(playlist3).to.not.be.undefined
+ await testImage(server.url, 'thumbnail', playlist3.thumbnailPath)
+ }
+
+ const res = await getVideoPlaylistsList(servers[2].url, 0, 5)
+ expect(res.body.data.find(p => p.displayName === 'playlist 2')).to.be.undefined
+ expect(res.body.data.find(p => p.displayName === 'playlist 3')).to.be.undefined
+ })
+
+ it('Should have the playlist on server 3 after a new follow', async function () {
+ this.timeout(30000)
+
+ // Server 2 and server 3 follow each other
+ await doubleFollow(servers[1], servers[2])
+
+ const res = await getVideoPlaylistsList(servers[2].url, 0, 5)
+
+ const playlist2 = res.body.data.find(p => p.displayName === 'playlist 2')
+ expect(playlist2).to.not.be.undefined
+ await testImage(servers[2].url, 'thumbnail-playlist', playlist2.thumbnailPath)
+
+ expect(res.body.data.find(p => p.displayName === 'playlist 3')).to.not.be.undefined
+ })