]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/video-change-ownership.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-change-ownership.ts
index 6ae6d3004b2d3faa81de21d4d6e2a4ab6bbdbeda..e9ef674931ff38b6b11d28d978b0abb6a45bd8ed 100644 (file)
@@ -1,7 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
 import {
   ChangeOwnershipCommand,
   cleanupTests,
@@ -12,11 +11,9 @@ import {
   setAccessTokensToServers,
   setDefaultVideoChannel,
   waitJobs
-} from '@shared/extra-utils'
+} from '@shared/server-commands'
 import { HttpStatusCode, VideoPrivacy } from '@shared/models'
 
-const expect = chai.expect
-
 describe('Test video change ownership - nominal', function () {
   let servers: PeerTubeServer[] = []
 
@@ -73,7 +70,7 @@ describe('Test video change ownership - nominal', function () {
       }
       const { id } = await servers[0].videos.upload({ token: firstUserToken, attributes })
 
-      servers[0].store.video = await servers[0].videos.get({ id })
+      servers[0].store.videoCreated = await servers[0].videos.get({ id })
     }
 
     {
@@ -109,7 +106,7 @@ describe('Test video change ownership - nominal', function () {
   it('Should send a request to change ownership of a video', async function () {
     this.timeout(15000)
 
-    await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
+    await command.create({ token: firstUserToken, videoId: servers[0].store.videoCreated.id, username: secondUser })
   })
 
   it('Should only return a request to change ownership for the second user', async function () {
@@ -135,7 +132,7 @@ describe('Test video change ownership - nominal', function () {
   it('Should accept the same change ownership request without crashing', async function () {
     this.timeout(10000)
 
-    await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
+    await command.create({ token: firstUserToken, videoId: servers[0].store.videoCreated.id, username: secondUser })
   })
 
   it('Should not create multiple change ownership requests while one is waiting', async function () {
@@ -163,7 +160,7 @@ describe('Test video change ownership - nominal', function () {
   it('Should send a new request to change ownership of a video', async function () {
     this.timeout(15000)
 
-    await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
+    await command.create({ token: firstUserToken, videoId: servers[0].store.videoCreated.id, username: secondUser })
   })
 
   it('Should return two requests to change ownership for the second user', async function () {
@@ -207,7 +204,7 @@ describe('Test video change ownership - nominal', function () {
 
   it('Should have the channel of the video updated', async function () {
     for (const server of servers) {
-      const video = await server.videos.get({ id: servers[0].store.video.uuid })
+      const video = await server.videos.get({ id: servers[0].store.videoCreated.uuid })
 
       expect(video.name).to.equal('my super name')
       expect(video.channel.displayName).to.equal('Main second channel')
@@ -236,7 +233,7 @@ describe('Test video change ownership - nominal', function () {
     await waitJobs(servers)
 
     for (const server of servers) {
-      const video = await server.videos.get({ id: servers[0].store.video.uuid })
+      const video = await server.videos.get({ id: servers[0].store.videoCreated.uuid })
 
       expect(video.name).to.equal('my super name')
       expect(video.channel.displayName).to.equal('Main second channel')
@@ -282,13 +279,13 @@ describe('Test video change ownership - quota too small', function () {
     const { data } = await server.videos.list()
     expect(data.length).to.equal(1)
 
-    server.store.video = data.find(video => video.name === 'my super name')
+    server.store.videoCreated = data.find(video => video.name === 'my super name')
   })
 
   it('Should send a request to change ownership of a video', async function () {
     this.timeout(15000)
 
-    await server.changeOwnership.create({ token: firstUserToken, videoId: server.store.video.id, username: secondUser })
+    await server.changeOwnership.create({ token: firstUserToken, videoId: server.store.videoCreated.id, username: secondUser })
   })
 
   it('Should only return a request to change ownership for the second user', async function () {