]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/api/videos/channel-import-videos.ts
Add missing job types to admin panel
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / channel-import-videos.ts
1 import { expect } from 'chai'
2 import { FIXTURE_URLS } from '@server/tests/shared'
3 import { areHttpImportTestsDisabled } from '@shared/core-utils'
4 import {
5 createSingleServer,
6 getServerImportConfig,
7 PeerTubeServer,
8 setAccessTokensToServers,
9 setDefaultVideoChannel,
10 waitJobs
11 } from '@shared/server-commands'
12
13 describe('Test videos import in a channel', function () {
14 if (areHttpImportTestsDisabled()) return
15
16 function runSuite (mode: 'youtube-dl' | 'yt-dlp') {
17
18 describe('Import using ' + mode, function () {
19 let server: PeerTubeServer
20
21 before(async function () {
22 this.timeout(120_000)
23
24 server = await createSingleServer(1, getServerImportConfig(mode))
25
26 await setAccessTokensToServers([ server ])
27 await setDefaultVideoChannel([ server ])
28
29 await server.config.enableChannelSync()
30 })
31
32 it('Should import a whole channel', async function () {
33 this.timeout(240_000)
34
35 await server.channels.importVideos({ channelName: server.store.channel.name, externalChannelUrl: FIXTURE_URLS.youtubeChannel })
36 await waitJobs(server)
37
38 const videos = await server.videos.listByChannel({ handle: server.store.channel.name })
39 expect(videos.total).to.equal(2)
40 })
41
42 after(async function () {
43 await server?.kill()
44 })
45 })
46 }
47
48 runSuite('yt-dlp')
49 runSuite('youtube-dl')
50 })