aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r--server/tests/utils/videos/video-imports.ts14
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 @@
1import { VideoImportCreate } from '../../../../shared/models/videos' 1import { VideoImportCreate } from '../../../../shared/models/videos'
2import { makeGetRequest, makePostBodyRequest } from '..' 2import { makeGetRequest, makePostBodyRequest, makeUploadRequest } from '..'
3 3
4function getYoutubeVideoUrl () { 4function getYoutubeVideoUrl () {
5 return 'https://youtu.be/msX3jv1XdvM' 5 return 'https://youtu.be/msX3jv1XdvM'
6} 6}
7 7
8function 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
8function importVideo (url: string, token: string, attributes: VideoImportCreate) { 13function 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) {
33export { 42export {
34 getYoutubeVideoUrl, 43 getYoutubeVideoUrl,
35 importVideo, 44 importVideo,
45 getMagnetURI,
36 getMyVideoImports 46 getMyVideoImports
37} 47}