X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideos-common-filters.ts;h=e7fc15e420119de7d54b5a00974c8f789ddf16ac;hb=8a6828b1664ce3fc535d23c54ed22bab35588d06;hp=4f22d4ac327394f8fafe4aeac93e1443bc39752b;hpb=d324756edb836672f12284cd18e642a658b273d8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts index 4f22d4ac3..e7fc15e42 100644 --- a/server/tests/api/videos/videos-common-filters.ts +++ b/server/tests/api/videos/videos-common-filters.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -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 +10,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[] @@ -23,12 +23,13 @@ describe('Test videos filter', function () { // --------------------------------------------------------------- before(async function () { - this.timeout(160000) + this.timeout(240000) servers = await createMultipleServers(2) await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) + await setDefaultAccountAvatar(servers) for (const server of servers) { const moderator = { username: 'moderator', password: 'my super password' } @@ -138,6 +139,7 @@ describe('Test videos filter', function () { hasWebtorrentFiles?: boolean hasHLSFiles?: boolean include?: VideoInclude + privacyOneOf?: VideoPrivacy[] category?: number tagsAllOf?: string[] token?: string @@ -148,7 +150,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 +164,7 @@ describe('Test videos filter', function () { server: PeerTubeServer isLocal?: boolean include?: VideoInclude + privacyOneOf?: VideoPrivacy[] token?: string expectedStatus?: HttpStatusCode }) { @@ -195,7 +198,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 +219,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)