]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/videos-common-filters.ts
Add missing job types to admin panel
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / videos-common-filters.ts
index 4f22d4ac327394f8fafe4aeac93e1443bc39752b..317de90a9fce002f1b92c8ef34e22cc4e8741198 100644 (file)
@@ -3,6 +3,7 @@
 import 'mocha'
 import { expect } from 'chai'
 import { pick } from '@shared/core-utils'
+import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
   createMultipleServers,
@@ -10,10 +11,10 @@ import {
   makeGetRequest,
   PeerTubeServer,
   setAccessTokensToServers,
+  setDefaultAccountAvatar,
   setDefaultVideoChannel,
   waitJobs
-} from '@shared/extra-utils'
-import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models'
+} from '@shared/server-commands'
 
 describe('Test videos filter', function () {
   let servers: PeerTubeServer[]
@@ -29,6 +30,7 @@ describe('Test videos filter', function () {
 
     await setAccessTokensToServers(servers)
     await setDefaultVideoChannel(servers)
+    await setDefaultAccountAvatar(servers)
 
     for (const server of servers) {
       const moderator = { username: 'moderator', password: 'my super password' }
@@ -138,6 +140,7 @@ describe('Test videos filter', function () {
       hasWebtorrentFiles?: boolean
       hasHLSFiles?: boolean
       include?: VideoInclude
+      privacyOneOf?: VideoPrivacy[]
       category?: number
       tagsAllOf?: string[]
       token?: string
@@ -148,7 +151,7 @@ describe('Test videos filter', function () {
         path: options.path,
         token: options.token ?? options.server.accessToken,
         query: {
-          ...pick(options, [ 'isLocal', 'include', 'category', 'tagsAllOf', 'hasWebtorrentFiles', 'hasHLSFiles' ]),
+          ...pick(options, [ 'isLocal', 'include', 'category', 'tagsAllOf', 'hasWebtorrentFiles', 'hasHLSFiles', 'privacyOneOf' ]),
 
           sort: 'createdAt'
         },
@@ -162,6 +165,7 @@ describe('Test videos filter', function () {
       server: PeerTubeServer
       isLocal?: boolean
       include?: VideoInclude
+      privacyOneOf?: VideoPrivacy[]
       token?: string
       expectedStatus?: HttpStatusCode
     }) {
@@ -195,7 +199,7 @@ describe('Test videos filter', function () {
             server,
             token,
             isLocal: true,
-            include: VideoInclude.HIDDEN_PRIVACY
+            privacyOneOf: [ VideoPrivacy.UNLISTED, VideoPrivacy.PUBLIC, VideoPrivacy.PRIVATE ]
           })
 
           for (const names of namesResults) {
@@ -216,7 +220,7 @@ describe('Test videos filter', function () {
           const [ channelVideos, accountVideos, videos, searchVideos ] = await getVideosNames({
             server,
             token,
-            include: VideoInclude.HIDDEN_PRIVACY
+            privacyOneOf: [ VideoPrivacy.UNLISTED, VideoPrivacy.PUBLIC, VideoPrivacy.PRIVATE ]
           })
 
           expect(channelVideos).to.have.lengthOf(3)