diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-07 11:56:18 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 09:30:31 +0200 |
commit | 187501f8b8e334f043ae1e9af3c9d4f45ea0e6c1 (patch) | |
tree | ea895cb9dd743e400b64ab1b3b1bbee4d2521a2b /server/tests/utils | |
parent | a84b8fa5cf6e4cafb841af3db9bdfcc9531c09a4 (diff) | |
download | PeerTube-187501f8b8e334f043ae1e9af3c9d4f45ea0e6c1.tar.gz PeerTube-187501f8b8e334f043ae1e9af3c9d4f45ea0e6c1.tar.zst PeerTube-187501f8b8e334f043ae1e9af3c9d4f45ea0e6c1.zip |
Add check param tests regarding video imports
Diffstat (limited to 'server/tests/utils')
-rw-r--r-- | server/tests/utils/videos/video-imports.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/tests/utils/videos/video-imports.ts b/server/tests/utils/videos/video-imports.ts index e0f916990..fa2f13b5e 100644 --- a/server/tests/utils/videos/video-imports.ts +++ b/server/tests/utils/videos/video-imports.ts | |||
@@ -1,17 +1,26 @@ | |||
1 | import { VideoImportCreate } from '../../../../shared/models/videos' | 1 | import { VideoImportCreate } from '../../../../shared/models/videos' |
2 | import { makeGetRequest, makePostBodyRequest } from '..' | 2 | import { makeGetRequest, makePostBodyRequest, makeUploadRequest } from '..' |
3 | 3 | ||
4 | function getYoutubeVideoUrl () { | 4 | function getYoutubeVideoUrl () { |
5 | return 'https://youtu.be/msX3jv1XdvM' | 5 | return 'https://youtu.be/msX3jv1XdvM' |
6 | } | 6 | } |
7 | 7 | ||
8 | function getMagnetURI () { | ||
9 | // tslint:disable:max-line-length | ||
10 | return 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2F2b8dbe74-9548-4f6f-a8da-986aed9e5e45-240.torrent&xt=urn:btih:52bf3729e5859390a8751495196b5674a55c99f3&dn=60fps_small&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%2F2b8dbe74-9548-4f6f-a8da-986aed9e5e45-240.mp4' | ||
11 | } | ||
12 | |||
8 | function importVideo (url: string, token: string, attributes: VideoImportCreate) { | 13 | function importVideo (url: string, token: string, attributes: VideoImportCreate) { |
9 | const path = '/api/v1/videos/imports' | 14 | const path = '/api/v1/videos/imports' |
10 | 15 | ||
11 | return makePostBodyRequest({ | 16 | let attaches: any = {} |
17 | if (attributes.torrentfile) attaches = { torrentfile: attributes.torrentfile } | ||
18 | |||
19 | return makeUploadRequest({ | ||
12 | url, | 20 | url, |
13 | path, | 21 | path, |
14 | token, | 22 | token, |
23 | attaches, | ||
15 | fields: attributes, | 24 | fields: attributes, |
16 | statusCodeExpected: 200 | 25 | statusCodeExpected: 200 |
17 | }) | 26 | }) |
@@ -33,5 +42,6 @@ function getMyVideoImports (url: string, token: string) { | |||
33 | export { | 42 | export { |
34 | getYoutubeVideoUrl, | 43 | getYoutubeVideoUrl, |
35 | importVideo, | 44 | importVideo, |
45 | getMagnetURI, | ||
36 | getMyVideoImports | 46 | getMyVideoImports |
37 | } | 47 | } |