]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/prune-storage.ts
Introduce sql command
[github/Chocobozzz/PeerTube.git] / server / tests / cli / prune-storage.ts
index 81f91105c72e3f0c9383fcd52f40378fae015d25..d4dbee682e00d64b08073ce33bd82711c82f3da4 100644 (file)
@@ -5,15 +5,13 @@ import * as chai from 'chai'
 import { createFile, readdir } from 'fs-extra'
 import { join } from 'path'
 import { buildUUID } from '@server/helpers/uuid'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
+import { HttpStatusCode } from '@shared/core-utils'
 import {
   buildServerDirectory,
   cleanupTests,
   CLICommand,
-  createVideoPlaylist,
   doubleFollow,
   flushAndRunMultipleServers,
-  getAccount,
   killallServers,
   makeGetRequest,
   ServerInfo,
@@ -21,10 +19,10 @@ import {
   setDefaultVideoChannel,
   updateMyAvatar,
   uploadVideo,
-  wait
-} from '../../../shared/extra-utils'
-import { waitJobs } from '../../../shared/extra-utils/server/jobs'
-import { Account, VideoPlaylistPrivacy } from '../../../shared/models'
+  wait,
+  waitJobs
+} from '@shared/extra-utils'
+import { VideoPlaylistPrivacy } from '@shared/models'
 
 const expect = chai.expect
 
@@ -78,10 +76,8 @@ describe('Test prune storage scripts', function () {
 
       await updateMyAvatar({ url: server.url, accessToken: server.accessToken, fixture: 'avatar.png' })
 
-      await createVideoPlaylist({
-        url: server.url,
-        token: server.accessToken,
-        playlistAttrs: {
+      await server.playlistsCommand.create({
+        attributes: {
           displayName: 'playlist',
           privacy: VideoPlaylistPrivacy.PUBLIC,
           videoChannelId: server.videoChannel.id,
@@ -94,8 +90,7 @@ describe('Test prune storage scripts', function () {
 
     // Lazy load the remote avatar
     {
-      const res = await getAccount(servers[0].url, 'root@localhost:' + servers[1].port)
-      const account: Account = res.body
+      const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port })
       await makeGetRequest({
         url: servers[0].url,
         path: account.avatar.path,
@@ -104,8 +99,7 @@ describe('Test prune storage scripts', function () {
     }
 
     {
-      const res = await getAccount(servers[1].url, 'root@localhost:' + servers[0].port)
-      const account: Account = res.body
+      const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port })
       await makeGetRequest({
         url: servers[1].url,
         path: account.avatar.path,
@@ -116,7 +110,7 @@ describe('Test prune storage scripts', function () {
     await wait(1000)
 
     await waitJobs(servers)
-    killallServers(servers)
+    await killallServers(servers)
 
     await wait(1000)
   })