]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/upload-quota.ts
Fix s3 mock cleanup
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / upload-quota.ts
index 4ca544790752d761d278b7a958403d83f3388ee2..06698c056c241a887d99bef86ca0b7ee95bc6717 100644 (file)
@@ -1,22 +1,21 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
 import { expect } from 'chai'
-import { HttpStatusCode, randomInt } from '@shared/core-utils'
+import { FIXTURE_URLS } from '@server/tests/shared'
+import { randomInt } from '@shared/core-utils'
+import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
-  flushAndRunServer,
-  ImportsCommand,
-  ServerInfo,
+  createSingleServer,
+  PeerTubeServer,
   setAccessTokensToServers,
   setDefaultVideoChannel,
   VideosCommand,
   waitJobs
-} from '@shared/extra-utils'
-import { VideoImportState, VideoPrivacy } from '@shared/models'
+} from '@shared/server-commands'
 
 describe('Test upload quota', function () {
-  let server: ServerInfo
+  let server: PeerTubeServer
   let rootId: number
   let command: VideosCommand
 
@@ -25,7 +24,7 @@ describe('Test upload quota', function () {
   before(async function () {
     this.timeout(30000)
 
-    server = await flushAndRunServer(1)
+    server = await createSingleServer(1)
     await setAccessTokensToServers([ server ])
     await setDefaultVideoChannel([ server ])
 
@@ -40,10 +39,10 @@ describe('Test upload quota', function () {
   describe('When having a video quota', function () {
 
     it('Should fail with a registered user having too many videos with legacy upload', async function () {
-      this.timeout(30000)
+      this.timeout(120000)
 
       const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
-      await server.users.register(user)
+      await server.registrations.register(user)
       const userToken = await server.login.getAccessToken(user)
 
       const attributes = { fixture: 'video_short2.webm' }
@@ -55,10 +54,10 @@ describe('Test upload quota', function () {
     })
 
     it('Should fail with a registered user having too many videos with resumable upload', async function () {
-      this.timeout(30000)
+      this.timeout(120000)
 
       const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
-      await server.users.register(user)
+      await server.registrations.register(user)
       const userToken = await server.login.getAccessToken(user)
 
       const attributes = { fixture: 'video_short2.webm' }
@@ -70,14 +69,14 @@ describe('Test upload quota', function () {
     })
 
     it('Should fail to import with HTTP/Torrent/magnet', async function () {
-      this.timeout(120000)
+      this.timeout(120_000)
 
       const baseAttributes = {
         channelId: server.store.channel.id,
         privacy: VideoPrivacy.PUBLIC
       }
-      await server.imports.importVideo({ attributes: { ...baseAttributes, targetUrl: ImportsCommand.getGoodVideoUrl() } })
-      await server.imports.importVideo({ attributes: { ...baseAttributes, magnetUri: ImportsCommand.getMagnetURI() } })
+      await server.imports.importVideo({ attributes: { ...baseAttributes, targetUrl: FIXTURE_URLS.goodVideo } })
+      await server.imports.importVideo({ attributes: { ...baseAttributes, magnetUri: FIXTURE_URLS.magnet } })
       await server.imports.importVideo({ attributes: { ...baseAttributes, torrentfile: 'video-720p.torrent' as any } })
 
       await waitJobs([ server ])