X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-privacy.ts;h=b18c71c940d18b0d9dbd62fd9e2e5d8dc4fbaa4c;hb=8a6828b1664ce3fc535d23c54ed22bab35588d06;hp=de08a9e7b6f8e5c1e1fc6bfa95071bcdd15149e4;hpb=89d241a79c262b9775c233b73cff080043ebb5e6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index de08a9e7b..b18c71c94 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts @@ -1,15 +1,12 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' -import { HttpStatusCode } from '@shared/core-utils' -import { cleanupTests, doubleFollow, flushAndRunServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' -import { VideoCreateResult, VideoPrivacy } from '@shared/models' - -const expect = chai.expect +import { expect } from 'chai' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' +import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' describe('Test video privacy', function () { - const servers: ServerInfo[] = [] + const servers: PeerTubeServer[] = [] let anotherUserToken: string let privateVideoId: number @@ -35,8 +32,8 @@ describe('Test video privacy', function () { this.timeout(50000) // Run servers - servers.push(await flushAndRunServer(1, dontFederateUnlistedConfig)) - servers.push(await flushAndRunServer(2)) + servers.push(await createSingleServer(1, dontFederateUnlistedConfig)) + servers.push(await createSingleServer(2)) // Get the access tokens await setAccessTokensToServers(servers) @@ -162,7 +159,7 @@ describe('Test video privacy', function () { }) it('Should not be able to get this unlisted video using its id', async function () { - await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) + await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) }) it('Should be able to get this unlisted video using its uuid/shortUUID', async function () { @@ -210,7 +207,7 @@ describe('Test video privacy', function () { describe('Privacy update', function () { it('Should update the private and internal videos to public on server 1', async function () { - this.timeout(10000) + this.timeout(100000) now = Date.now() @@ -231,6 +228,7 @@ describe('Test video privacy', function () { await servers[0].videos.update({ id: internalVideoId, attributes }) } + await wait(10000) await waitJobs(servers) })