+ it('Should update the private and internal videos to public on server 1', async function () {
+ this.timeout(100000)
+
+ now = Date.now()
+
+ {
+ const attributes = {
+ name: 'private video becomes public',
+ privacy: VideoPrivacy.PUBLIC
+ }
+
+ await servers[0].videos.update({ id: privateVideoId, attributes })
+ }
+
+ {
+ const attributes = {
+ name: 'internal video becomes public',
+ privacy: VideoPrivacy.PUBLIC
+ }
+ await servers[0].videos.update({ id: internalVideoId, attributes })
+ }
+
+ await wait(10000)
+ await waitJobs(servers)
+ })
+
+ it('Should have this new public video listed on server 1 and 2', async function () {
+ for (const server of servers) {
+ const { total, data } = await server.videos.list()
+ expect(total).to.equal(2)
+ expect(data).to.have.lengthOf(2)
+
+ const privateVideo = data.find(v => v.name === 'private video becomes public')
+ const internalVideo = data.find(v => v.name === 'internal video becomes public')
+
+ expect(privateVideo).to.not.be.undefined
+ expect(internalVideo).to.not.be.undefined
+
+ expect(new Date(privateVideo.publishedAt).getTime()).to.be.at.least(now)
+ // We don't change the publish date of internal videos
+ expect(new Date(internalVideo.publishedAt).getTime()).to.be.below(now)
+
+ expect(privateVideo.privacy.id).to.equal(VideoPrivacy.PUBLIC)
+ expect(internalVideo.privacy.id).to.equal(VideoPrivacy.PUBLIC)
+ }
+ })
+
+ it('Should set these videos as private and internal', async function () {
+ this.timeout(10000)
+
+ await servers[0].videos.update({ id: internalVideoId, attributes: { privacy: VideoPrivacy.PRIVATE } })
+ await servers[0].videos.update({ id: privateVideoId, attributes: { privacy: VideoPrivacy.INTERNAL } })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const { total, data } = await server.videos.list()
+
+ expect(total).to.equal(0)
+ expect(data).to.have.lengthOf(0)
+ }
+
+ {
+ const { total, data } = await servers[0].videos.listMyVideos()
+ expect(total).to.equal(3)
+ expect(data).to.have.lengthOf(3)
+
+ const privateVideo = data.find(v => v.name === 'private video becomes public')
+ const internalVideo = data.find(v => v.name === 'internal video becomes public')
+
+ expect(privateVideo).to.not.be.undefined
+ expect(internalVideo).to.not.be.undefined
+
+ expect(privateVideo.privacy.id).to.equal(VideoPrivacy.INTERNAL)
+ expect(internalVideo.privacy.id).to.equal(VideoPrivacy.PRIVATE)
+ }
+ })