/* 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
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)
describe('Private and internal videos', function () {
it('Should upload a private and internal videos on server 1', async function () {
- this.timeout(10000)
+ this.timeout(50000)
for (const privacy of [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]) {
const attributes = { privacy }
describe('Unlisted videos', function () {
it('Should upload an unlisted video on server 2', async function () {
- this.timeout(60000)
+ this.timeout(120000)
const attributes = {
name: 'unlisted video',
})
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 () {
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()
await servers[0].videos.update({ id: internalVideoId, attributes })
}
+ await wait(10000)
await waitJobs(servers)
})