diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-30 09:43:12 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-31 11:32:04 +0200 |
commit | b488ba1e26b803ac6c637e8b11bdd444ca4c803f (patch) | |
tree | 0a9ce01fcfb26ecddd8a0dccf997514818b8a72f /server/tests/api/videos | |
parent | b9fe9a7ffdf80d81c5580ccccfeb989051fd9d8a (diff) | |
download | PeerTube-b488ba1e26b803ac6c637e8b11bdd444ca4c803f.tar.gz PeerTube-b488ba1e26b803ac6c637e8b11bdd444ca4c803f.tar.zst PeerTube-b488ba1e26b803ac6c637e8b11bdd444ca4c803f.zip |
Don't rely on youtube for tests
Use another import URL when possible, and disable import tests when we
want to do a youtube import test
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/video-blacklist.ts | 10 | ||||
-rw-r--r-- | server/tests/api/videos/video-imports.ts | 14 |
2 files changed, 13 insertions, 11 deletions
diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts index a8500627b..52cac20d9 100644 --- a/server/tests/api/videos/video-blacklist.ts +++ b/server/tests/api/videos/video-blacklist.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | ||
3 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
4 | import { orderBy } from 'lodash' | 5 | import { orderBy } from 'lodash' |
5 | import 'mocha' | ||
6 | import { | 6 | import { |
7 | addVideoToBlacklist, | 7 | addVideoToBlacklist, |
8 | cleanupTests, | 8 | cleanupTests, |
@@ -25,10 +25,10 @@ import { | |||
25 | } from '../../../../shared/extra-utils/index' | 25 | } from '../../../../shared/extra-utils/index' |
26 | import { doubleFollow } from '../../../../shared/extra-utils/server/follows' | 26 | import { doubleFollow } from '../../../../shared/extra-utils/server/follows' |
27 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 27 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
28 | import { VideoBlacklist, VideoBlacklistType } from '../../../../shared/models/videos' | 28 | import { getGoodVideoUrl, getMagnetURI, importVideo } from '../../../../shared/extra-utils/videos/video-imports' |
29 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' | ||
30 | import { User, UserRole } from '../../../../shared/models/users' | 29 | import { User, UserRole } from '../../../../shared/models/users' |
31 | import { getMagnetURI, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' | 30 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' |
31 | import { VideoBlacklist, VideoBlacklistType } from '../../../../shared/models/videos' | ||
32 | 32 | ||
33 | const expect = chai.expect | 33 | const expect = chai.expect |
34 | 34 | ||
@@ -424,7 +424,7 @@ describe('Test video blacklist', function () { | |||
424 | this.timeout(15000) | 424 | this.timeout(15000) |
425 | 425 | ||
426 | const attributes = { | 426 | const attributes = { |
427 | targetUrl: getYoutubeVideoUrl(), | 427 | targetUrl: getGoodVideoUrl(), |
428 | name: 'URL import', | 428 | name: 'URL import', |
429 | channelId: channelOfUserWithoutFlag | 429 | channelId: channelOfUserWithoutFlag |
430 | } | 430 | } |
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 05ee36b27..efda4fc7b 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
5 | import { VideoDetails, VideoImport, VideoPrivacy, VideoCaption } from '../../../../shared/models/videos' | 4 | import * as chai from 'chai' |
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | doubleFollow, | 7 | doubleFollow, |
@@ -11,15 +10,16 @@ import { | |||
11 | getMyVideos, | 10 | getMyVideos, |
12 | getVideo, | 11 | getVideo, |
13 | getVideosList, | 12 | getVideosList, |
14 | listVideoCaptions, | ||
15 | testCaptionFile, | ||
16 | immutableAssign, | 13 | immutableAssign, |
14 | listVideoCaptions, | ||
17 | ServerInfo, | 15 | ServerInfo, |
18 | setAccessTokensToServers | 16 | setAccessTokensToServers, |
17 | testCaptionFile | ||
19 | } from '../../../../shared/extra-utils' | 18 | } from '../../../../shared/extra-utils' |
19 | import { areHttpImportTestsDisabled, testImage } from '../../../../shared/extra-utils/miscs/miscs' | ||
20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
21 | import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' | 21 | import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' |
22 | import { testImage } from '../../../../shared/extra-utils/miscs/miscs' | 22 | import { VideoCaption, VideoDetails, VideoImport, VideoPrivacy } from '../../../../shared/models/videos' |
23 | 23 | ||
24 | const expect = chai.expect | 24 | const expect = chai.expect |
25 | 25 | ||
@@ -28,6 +28,8 @@ describe('Test video imports', function () { | |||
28 | let channelIdServer1: number | 28 | let channelIdServer1: number |
29 | let channelIdServer2: number | 29 | let channelIdServer2: number |
30 | 30 | ||
31 | if (areHttpImportTestsDisabled()) return | ||
32 | |||
31 | async function checkVideosServer1 (url: string, idHttp: string, idMagnet: string, idTorrent: string) { | 33 | async function checkVideosServer1 (url: string, idHttp: string, idMagnet: string, idTorrent: string) { |
32 | const resHttp = await getVideo(url, idHttp) | 34 | const resHttp = await getVideo(url, idHttp) |
33 | const videoHttp: VideoDetails = resHttp.body | 35 | const videoHttp: VideoDetails = resHttp.body |