From 59bbcced37005dd511daca9bd58ae2998cb931b1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 10:19:16 +0200 Subject: Centralize test URLs --- shared/extra-utils/miscs/tests.ts | 32 +++++++++++++++++++++++ shared/extra-utils/requests/requests.ts | 5 ---- shared/extra-utils/videos/imports-command.ts | 38 ---------------------------- 3 files changed, 32 insertions(+), 43 deletions(-) (limited to 'shared') diff --git a/shared/extra-utils/miscs/tests.ts b/shared/extra-utils/miscs/tests.ts index 8f7a2f92b..3dfb2487e 100644 --- a/shared/extra-utils/miscs/tests.ts +++ b/shared/extra-utils/miscs/tests.ts @@ -1,6 +1,36 @@ import { stat } from 'fs-extra' import { basename, isAbsolute, join, resolve } from 'path' +const FIXTURE_URLS = { + youtube: 'https://www.youtube.com/watch?v=msX3jv1XdvM', + + /** + * The video is used to check format-selection correctness wrt. HDR, + * which brings its own set of oddities outside of a MediaSource. + * FIXME: refactor once HDR is supported at playback + * + * The video needs to have the following format_ids: + * (which you can check by using `youtube-dl -F`): + * - 303 (1080p webm vp9) + * - 299 (1080p mp4 avc1) + * - 335 (1080p webm vp9.2 HDR) + * + * 15 jan. 2021: TEST VIDEO NOT CURRENTLY PROVIDING + * - 400 (1080p mp4 av01) + * - 315 (2160p webm vp9 HDR) + * - 337 (2160p webm vp9.2 HDR) + * - 401 (2160p mp4 av01 HDR) + */ + youtubeHDR: 'https://www.youtube.com/watch?v=qR5vOXbZsI4', + + // eslint-disable-next-line max-len + magnet: 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4', + + badVideo: 'https://download.cpy.re/peertube/bad_video.mp4', + goodVideo: 'https://download.cpy.re/peertube/good_video.mp4', + video4K: 'https://download.cpy.re/peertube/4k_file.txt' +} + function parallelTests () { return process.env.MOCHA_PARALLEL === 'true' } @@ -51,6 +81,8 @@ function buildRequestStub (): any { } export { + FIXTURE_URLS, + parallelTests, isGithubCI, areHttpImportTestsDisabled, diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.ts index 3f1ac6650..60c9b938b 100644 --- a/shared/extra-utils/requests/requests.ts +++ b/shared/extra-utils/requests/requests.ts @@ -7,10 +7,6 @@ import { URL } from 'url' import { HttpStatusCode } from '@shared/core-utils' import { buildAbsoluteFixturePath, root } from '../miscs/tests' -function get4KFileUrl () { - return 'https://download.cpy.re/peertube/4k_file.txt' -} - function makeRawRequest (url: string, statusCodeExpected?: HttpStatusCode, range?: string) { const { host, protocol, pathname } = new URL(url) @@ -227,7 +223,6 @@ function unwrapText (test: request.Test): Promise { // --------------------------------------------------------------------------- export { - get4KFileUrl, makeHTMLRequest, makeGetRequest, decodeQueryString, diff --git a/shared/extra-utils/videos/imports-command.ts b/shared/extra-utils/videos/imports-command.ts index 024aa363f..de8b65829 100644 --- a/shared/extra-utils/videos/imports-command.ts +++ b/shared/extra-utils/videos/imports-command.ts @@ -7,44 +7,6 @@ import { AbstractCommand, OverrideCommandOptions } from '../shared' export class ImportsCommand extends AbstractCommand { - static getYoutubeVideoUrl () { - return 'https://www.youtube.com/watch?v=msX3jv1XdvM' - } - - static getYoutubeHDRVideoUrl () { - /** - * The video is used to check format-selection correctness wrt. HDR, - * which brings its own set of oddities outside of a MediaSource. - * FIXME: refactor once HDR is supported at playback - * - * The video needs to have the following format_ids: - * (which you can check by using `youtube-dl -F`): - * - 303 (1080p webm vp9) - * - 299 (1080p mp4 avc1) - * - 335 (1080p webm vp9.2 HDR) - * - * 15 jan. 2021: TEST VIDEO NOT CURRENTLY PROVIDING - * - 400 (1080p mp4 av01) - * - 315 (2160p webm vp9 HDR) - * - 337 (2160p webm vp9.2 HDR) - * - 401 (2160p mp4 av01 HDR) - */ - return 'https://www.youtube.com/watch?v=qR5vOXbZsI4' - } - - static getMagnetURI () { - // eslint-disable-next-line max-len - return 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4' - } - - static getBadVideoUrl () { - return 'https://download.cpy.re/peertube/bad_video.mp4' - } - - static getGoodVideoUrl () { - return 'https://download.cpy.re/peertube/good_video.mp4' - } - importVideo (options: OverrideCommandOptions & { attributes: VideoImportCreate & { torrentfile?: string } }) { -- cgit v1.2.3