X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fsingle-server.ts;h=0e429fef75864baf85eea300e6d33ef026efc6b8;hb=c6f8ca4d6596572de981162983bd02eb2613791d;hp=c0535be09d3be2e1a16c516786551008800678bf;hpb=254d3579f5338f5fd775c17d15cdfc37078bcfb4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index c0535be09..0e429fef7 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -2,17 +2,17 @@ import 'mocha' import * as chai from 'chai' +import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { Video, VideoPrivacy } from '@shared/models' import { - checkVideoFilesWereRemoved, cleanupTests, - completeVideoCheck, createSingleServer, PeerTubeServer, setAccessTokensToServers, - testImage, - wait -} from '@shared/extra-utils' -import { Video, VideoPrivacy } from '@shared/models' + setDefaultAccountAvatar, + setDefaultChannelAvatar +} from '@shared/server-commands' const expect = chai.expect @@ -97,6 +97,8 @@ describe('Test a single server', function () { server = await createSingleServer(1) await setAccessTokensToServers([ server ]) + await setDefaultChannelAvatar(server) + await setDefaultAccountAvatar(server) }) it('Should list video categories', async function () { @@ -177,31 +179,31 @@ describe('Test a single server', function () { it('Should have the views updated', async function () { this.timeout(20000) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) await wait(1500) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) await wait(1500) - await server.videos.view({ id: videoId }) - await server.videos.view({ id: videoId }) + await server.views.simulateView({ id: videoId }) + await server.views.simulateView({ id: videoId }) - // Wait the repeatable job - await wait(8000) + await server.debug.sendCommand({ body: { command: 'process-video-views-buffer' } }) const video = await server.videos.get({ id: videoId }) expect(video.views).to.equal(3) }) it('Should remove the video', async function () { + const video = await server.videos.get({ id: videoId }) await server.videos.remove({ id: videoId }) - await checkVideoFilesWereRemoved(videoUUID, server) + await checkVideoFilesWereRemoved({ video, server }) }) it('Should not have videos', async function () { @@ -353,19 +355,6 @@ describe('Test a single server', function () { await server.videos.update({ id: videoId, attributes }) }) - it('Should filter by tags and category', async function () { - { - const { data, total } = await server.videos.list({ tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: [ 4 ] }) - expect(total).to.equal(1) - expect(data[0].name).to.equal('my super video updated') - } - - { - const { total } = await server.videos.list({ tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: [ 3 ] }) - expect(total).to.equal(0) - } - }) - it('Should have the video updated', async function () { this.timeout(60000)