X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-imports.ts;h=1086886513633b3a1d2f1bb11af2a5471b76fe17;hb=e3c9ea722629a7d2b5656299ea51aec8c903b8ae;hp=4ef55c3af4bd44dfa12b26c5b6d62f5e078d709a;hpb=254d3579f5338f5fd775c17d15cdfc37078bcfb4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 4ef55c3af..108688651 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts @@ -5,9 +5,9 @@ import * as chai from 'chai' import { areHttpImportTestsDisabled, cleanupTests, - doubleFollow, createMultipleServers, - ImportsCommand, + doubleFollow, + FIXTURE_URLS, PeerTubeServer, setAccessTokensToServers, testCaptionFile, @@ -59,7 +59,7 @@ describe('Test video imports', function () { expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') expect(videoMagnet.name).to.contain('super peertube2 video') - const bodyCaptions = await server.captions.listVideoCaptions({ videoId: idHttp }) + const bodyCaptions = await server.captions.list({ videoId: idHttp }) expect(bodyCaptions.total).to.equal(2) } @@ -76,7 +76,7 @@ describe('Test video imports', function () { expect(video.files).to.have.lengthOf(1) - const bodyCaptions = await server.captions.listVideoCaptions({ videoId: id }) + const bodyCaptions = await server.captions.list({ videoId: id }) expect(bodyCaptions.total).to.equal(2) } @@ -110,7 +110,7 @@ describe('Test video imports', function () { } { - const attributes = { ...baseAttributes, targetUrl: ImportsCommand.getYoutubeVideoUrl() } + const attributes = { ...baseAttributes, targetUrl: FIXTURE_URLS.youtube } const { video } = await servers[0].imports.importVideo({ attributes }) expect(video.name).to.equal('small video - youtube') @@ -120,7 +120,7 @@ describe('Test video imports', function () { await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath) await testImage(servers[0].url, 'video_import_preview', video.previewPath) - const bodyCaptions = await servers[0].captions.listVideoCaptions({ videoId: video.id }) + const bodyCaptions = await servers[0].captions.list({ videoId: video.id }) const videoCaptions = bodyCaptions.data expect(videoCaptions).to.have.lengthOf(2) @@ -162,7 +162,7 @@ Ajouter un sous-titre est vraiment facile`) { const attributes = { ...baseAttributes, - magnetUri: ImportsCommand.getMagnetURI(), + magnetUri: FIXTURE_URLS.magnet, description: 'this is a super torrent description', tags: [ 'tag_torrent1', 'tag_torrent2' ] } @@ -199,13 +199,13 @@ Ajouter un sous-titre est vraiment facile`) expect(videoImports).to.have.lengthOf(3) - expect(videoImports[2].targetUrl).to.equal(ImportsCommand.getYoutubeVideoUrl()) + expect(videoImports[2].targetUrl).to.equal(FIXTURE_URLS.youtube) expect(videoImports[2].magnetUri).to.be.null expect(videoImports[2].torrentName).to.be.null expect(videoImports[2].video.name).to.equal('small video - youtube') expect(videoImports[1].targetUrl).to.be.null - expect(videoImports[1].magnetUri).to.equal(ImportsCommand.getMagnetURI()) + expect(videoImports[1].magnetUri).to.equal(FIXTURE_URLS.magnet) expect(videoImports[1].torrentName).to.be.null expect(videoImports[1].video.name).to.equal('super peertube2 video') @@ -234,7 +234,7 @@ Ajouter un sous-titre est vraiment facile`) this.timeout(60_000) const attributes = { - targetUrl: ImportsCommand.getYoutubeVideoUrl(), + targetUrl: FIXTURE_URLS.youtube, channelId: channelIdServer2, privacy: VideoPrivacy.PUBLIC, category: 10, @@ -270,7 +270,7 @@ Ajouter un sous-titre est vraiment facile`) const attributes = { name: 'transcoded video', - magnetUri: ImportsCommand.getMagnetURI(), + magnetUri: FIXTURE_URLS.magnet, channelId: channelIdServer2, privacy: VideoPrivacy.PUBLIC } @@ -320,7 +320,7 @@ Ajouter un sous-titre est vraiment facile`) const attributes = { name: 'hdr video', - targetUrl: ImportsCommand.getYoutubeHDRVideoUrl(), + targetUrl: FIXTURE_URLS.youtubeHDR, channelId: channelIdServer1, privacy: VideoPrivacy.PUBLIC } @@ -336,6 +336,32 @@ Ajouter un sous-titre est vraiment facile`) expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P) }) + it('Should import a peertube video', async function () { + this.timeout(120_000) + + // TODO: include peertube_short when https://github.com/ytdl-org/youtube-dl/pull/29475 is merged + for (const targetUrl of [ FIXTURE_URLS.peertube_long ]) { + // for (const targetUrl of [ FIXTURE_URLS.peertube_long, FIXTURE_URLS.peertube_short ]) { + await servers[0].config.disableTranscoding() + + const attributes = { + targetUrl, + channelId: channelIdServer1, + privacy: VideoPrivacy.PUBLIC + } + const { video } = await servers[0].imports.importVideo({ attributes }) + const videoUUID = video.uuid + + await waitJobs(servers) + + for (const server of servers) { + const video = await server.videos.get({ id: videoUUID }) + + expect(video.name).to.equal('E2E tests') + } + } + }) + after(async function () { await cleanupTests(servers) })