X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-privacy.ts;h=ef1cf0f071ed23f7544f32013aecc1c2d27ddf71;hb=bec4ea343987c69252b84d02f444c0f033d4a3f9;hp=8ab37189a6d1944d23a189381d921e44d28752e2;hpb=c49db162ee3ad0acf89f4e71ac0083b30ab798ea;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index 8ab37189a..ef1cf0f07 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts @@ -4,19 +4,19 @@ import * as chai from 'chai' import 'mocha' import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' import { + cleanupTests, flushAndRunMultipleServers, - flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, - uploadVideo, - wait -} from '../../utils/index' -import { doubleFollow } from '../../utils/server/follows' -import { userLogin } from '../../utils/users/login' -import { createUser } from '../../utils/users/users' -import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos' + uploadVideo +} from '../../../../shared/extra-utils/index' +import { doubleFollow } from '../../../../shared/extra-utils/server/follows' +import { userLogin } from '../../../../shared/extra-utils/users/login' +import { createUser } from '../../../../shared/extra-utils/users/users' +import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../../../shared/extra-utils/videos/videos' +import { waitJobs } from '../../../../shared/extra-utils/server/jobs' const expect = chai.expect @@ -48,7 +48,7 @@ describe('Test video privacy', function () { } await uploadVideo(servers[0].url, servers[0].accessToken, attributes) - await wait(5000) + await waitJobs(servers) }) it('Should not have this private video on server 2', async function () { @@ -73,11 +73,13 @@ describe('Test video privacy', function () { }) it('Should not be able to watch this private video with another user', async function () { + this.timeout(10000) + const user = { username: 'hello', password: 'super password' } - await createUser(servers[0].url, servers[0].accessToken, user.username, user.password) + await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password }) const token = await userLogin(servers[0], user) await getVideoWithToken(servers[0].url, token, privateVideoUUID, 403) @@ -97,7 +99,7 @@ describe('Test video privacy', function () { await uploadVideo(servers[1].url, servers[1].accessToken, attributes) // Server 2 has transcoding enabled - await wait(10000) + await waitJobs(servers) }) it('Should not have this unlisted video listed on server 1 and 2', async function () { @@ -137,7 +139,7 @@ describe('Test video privacy', function () { now = Date.now() await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute) - await wait(5000) + await waitJobs(servers) }) it('Should have this new public video listed on server 1 and 2', async function () { @@ -152,11 +154,6 @@ describe('Test video privacy', function () { }) after(async function () { - killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests(servers) }) })