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/check-params | |
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/check-params')
-rw-r--r-- | server/tests/api/check-params/users.ts | 13 | ||||
-rw-r--r-- | server/tests/api/check-params/video-imports.ts | 24 |
2 files changed, 17 insertions, 20 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 2fea2cbd5..3e53c445d 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -1,10 +1,10 @@ | |||
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 { omit } from 'lodash' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | ||
5 | import { omit } from 'lodash' | ||
5 | import { join } from 'path' | 6 | import { join } from 'path' |
6 | import { User, UserRole, VideoImport, VideoImportState } from '../../../../shared' | 7 | import { User, UserRole, VideoImport, VideoImportState } from '../../../../shared' |
7 | |||
8 | import { | 8 | import { |
9 | addVideoChannel, | 9 | addVideoChannel, |
10 | blockUser, | 10 | blockUser, |
@@ -31,17 +31,16 @@ import { | |||
31 | uploadVideo, | 31 | uploadVideo, |
32 | userLogin | 32 | userLogin |
33 | } from '../../../../shared/extra-utils' | 33 | } from '../../../../shared/extra-utils' |
34 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' | ||
34 | import { | 35 | import { |
35 | checkBadCountPagination, | 36 | checkBadCountPagination, |
36 | checkBadSortPagination, | 37 | checkBadSortPagination, |
37 | checkBadStartPagination | 38 | checkBadStartPagination |
38 | } from '../../../../shared/extra-utils/requests/check-api-params' | 39 | } from '../../../../shared/extra-utils/requests/check-api-params' |
39 | import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' | ||
40 | import { VideoPrivacy } from '../../../../shared/models/videos' | ||
41 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 40 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
42 | import { expect } from 'chai' | 41 | import { getMagnetURI, getMyVideoImports, getGoodVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' |
43 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' | 42 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' |
44 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' | 43 | import { VideoPrivacy } from '../../../../shared/models/videos' |
45 | 44 | ||
46 | describe('Test users API validators', function () { | 45 | describe('Test users API validators', function () { |
47 | const path = '/api/v1/users/' | 46 | const path = '/api/v1/users/' |
@@ -1047,7 +1046,7 @@ describe('Test users API validators', function () { | |||
1047 | channelId: 1, | 1046 | channelId: 1, |
1048 | privacy: VideoPrivacy.PUBLIC | 1047 | privacy: VideoPrivacy.PUBLIC |
1049 | } | 1048 | } |
1050 | await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() })) | 1049 | await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { targetUrl: getGoodVideoUrl() })) |
1051 | await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { magnetUri: getMagnetURI() })) | 1050 | await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { magnetUri: getMagnetURI() })) |
1052 | await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { torrentfile: 'video-720p.torrent' as any })) | 1051 | await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { torrentfile: 'video-720p.torrent' as any })) |
1053 | 1052 | ||
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 3759e47c4..f954ba089 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -1,9 +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 { omit } from 'lodash' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | ||
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' | ||
7 | import { | 6 | import { |
8 | cleanupTests, | 7 | cleanupTests, |
9 | createUser, | 8 | createUser, |
@@ -23,7 +22,8 @@ import { | |||
23 | checkBadSortPagination, | 22 | checkBadSortPagination, |
24 | checkBadStartPagination | 23 | checkBadStartPagination |
25 | } from '../../../../shared/extra-utils/requests/check-api-params' | 24 | } from '../../../../shared/extra-utils/requests/check-api-params' |
26 | import { getMagnetURI, getYoutubeVideoUrl } from '../../../../shared/extra-utils/videos/video-imports' | 25 | import { getMagnetURI, getGoodVideoUrl } from '../../../../shared/extra-utils/videos/video-imports' |
26 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' | ||
27 | 27 | ||
28 | describe('Test video imports API validator', function () { | 28 | describe('Test video imports API validator', function () { |
29 | const path = '/api/v1/videos/imports' | 29 | const path = '/api/v1/videos/imports' |
@@ -76,7 +76,7 @@ describe('Test video imports API validator', function () { | |||
76 | 76 | ||
77 | before(function () { | 77 | before(function () { |
78 | baseCorrectParams = { | 78 | baseCorrectParams = { |
79 | targetUrl: getYoutubeVideoUrl(), | 79 | targetUrl: getGoodVideoUrl(), |
80 | name: 'my super name', | 80 | name: 'my super name', |
81 | category: 5, | 81 | category: 5, |
82 | licence: 1, | 82 | licence: 1, |
@@ -246,15 +246,13 @@ describe('Test video imports API validator', function () { | |||
246 | it('Should succeed with the correct parameters', async function () { | 246 | it('Should succeed with the correct parameters', async function () { |
247 | this.timeout(30000) | 247 | this.timeout(30000) |
248 | 248 | ||
249 | { | 249 | await makePostBodyRequest({ |
250 | await makePostBodyRequest({ | 250 | url: server.url, |
251 | url: server.url, | 251 | path, |
252 | path, | 252 | token: server.accessToken, |
253 | token: server.accessToken, | 253 | fields: baseCorrectParams, |
254 | fields: baseCorrectParams, | 254 | statusCodeExpected: 200 |
255 | statusCodeExpected: 200 | 255 | }) |
256 | }) | ||
257 | } | ||
258 | }) | 256 | }) |
259 | 257 | ||
260 | it('Should forbid to import http videos', async function () { | 258 | it('Should forbid to import http videos', async function () { |