X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fhandle-down.ts;h=068654d8c4f3906b73c4ce21bed57b6b013e8f3f;hb=86aafd06f2d124786ea3d10477f356c2e3f85dd6;hp=8e162b69ec1452a144ae1a0b1c612f5e64bde4dc;hpb=bc22d60899e14631cba0fb6450f4e85fc9528293;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 8e162b69e..068654d8c 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -7,29 +7,29 @@ import { VideoPrivacy } from '../../../../shared/models/videos' import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' import { + cleanupTests, completeVideoCheck, - getVideo, - immutableAssign, - reRunServer, - unfollow, - viewVideo, flushAndRunMultipleServers, + getVideo, getVideosList, + immutableAssign, killallServers, + reRunServer, ServerInfo, setAccessTokensToServers, - uploadVideo, + unfollow, updateVideo, + uploadVideo, wait -} from '../../../../shared/utils' -import { follow, getFollowersListPaginationAndSort } from '../../../../shared/utils/server/follows' -import { getJobsListPaginationAndSort, waitJobs } from '../../../../shared/utils/server/jobs' +} from '../../../../shared/extra-utils' +import { follow, getFollowersListPaginationAndSort } from '../../../../shared/extra-utils/server/follows' +import { getJobsListPaginationAndSort, waitJobs } from '../../../../shared/extra-utils/server/jobs' import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments -} from '../../../../shared/utils/videos/video-comments' +} from '../../../../shared/extra-utils/videos/video-comments' const expect = chai.expect @@ -60,47 +60,50 @@ describe('Test handle downs', function () { privacy: VideoPrivacy.UNLISTED }) - const checkAttributes = { - name: 'my super name for server 1', - category: 5, - licence: 4, - language: 'ja', - nsfw: true, - description: 'my super description for server 1', - support: 'my super support text for server 1', - account: { - name: 'root', - host: 'localhost:9001' - }, - isLocal: false, - duration: 10, - tags: [ 'tag1p1', 'tag2p1' ], - privacy: VideoPrivacy.PUBLIC, - commentsEnabled: true, - channel: { - name: 'root_channel', - displayName: 'Main root channel', - description: '', - isLocal: false - }, - fixture: 'video_short1.webm', - files: [ - { - resolution: 720, - size: 572456 - } - ] - } - - const unlistedCheckAttributes = immutableAssign(checkAttributes, { - privacy: VideoPrivacy.UNLISTED - }) + let checkAttributes: any + let unlistedCheckAttributes: any before(async function () { this.timeout(30000) servers = await flushAndRunMultipleServers(3) + checkAttributes = { + name: 'my super name for server 1', + category: 5, + licence: 4, + language: 'ja', + nsfw: true, + description: 'my super description for server 1', + support: 'my super support text for server 1', + account: { + name: 'root', + host: 'localhost:' + servers[0].port + }, + isLocal: false, + duration: 10, + tags: [ 'tag1p1', 'tag2p1' ], + privacy: VideoPrivacy.PUBLIC, + commentsEnabled: true, + downloadEnabled: true, + channel: { + name: 'root_channel', + displayName: 'Main root channel', + description: '', + isLocal: false + }, + fixture: 'video_short1.webm', + files: [ + { + resolution: 720, + size: 572456 + } + ] + } + unlistedCheckAttributes = immutableAssign(checkAttributes, { + privacy: VideoPrivacy.UNLISTED + }) + // Get the access tokens await setAccessTokensToServers(servers) }) @@ -171,7 +174,7 @@ describe('Test handle downs', function () { const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 2, 'createdAt') expect(res.body.data).to.be.an('array') expect(res.body.data).to.have.lengthOf(1) - expect(res.body.data[0].follower.host).to.equal('localhost:9003') + expect(res.body.data[0].follower.host).to.equal('localhost:' + servers[2].port) }) it('Should not have pending/processing jobs anymore', async function () { @@ -297,6 +300,6 @@ describe('Test handle downs', function () { }) after(async function () { - killallServers(servers) + await cleanupTests(servers) }) })