diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-06 12:11:08 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-06 12:11:08 +0200 |
commit | 3d52b300ea79bec21f090e2447c4808307078618 (patch) | |
tree | 5a68db9d557eb9449533162cf01f974e60b16885 /server/tests/utils | |
parent | 60979b076de00a7c7f6dde26617cd39357d9fc6d (diff) | |
parent | 2769e297ca6703f761f9b57792585eb1fc5aac49 (diff) | |
download | PeerTube-3d52b300ea79bec21f090e2447c4808307078618.tar.gz PeerTube-3d52b300ea79bec21f090e2447c4808307078618.tar.zst PeerTube-3d52b300ea79bec21f090e2447c4808307078618.zip |
Merge branch 'release/beta-10' into develop
Diffstat (limited to 'server/tests/utils')
-rw-r--r-- | server/tests/utils/requests/requests.ts | 8 | ||||
-rw-r--r-- | server/tests/utils/videos/video-captions.ts | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/server/tests/utils/requests/requests.ts b/server/tests/utils/requests/requests.ts index b88b3ce5b..fc7b38b8c 100644 --- a/server/tests/utils/requests/requests.ts +++ b/server/tests/utils/requests/requests.ts | |||
@@ -48,7 +48,7 @@ function makeUploadRequest (options: { | |||
48 | path: string, | 48 | path: string, |
49 | token?: string, | 49 | token?: string, |
50 | fields: { [ fieldName: string ]: any }, | 50 | fields: { [ fieldName: string ]: any }, |
51 | attaches: { [ attachName: string ]: any }, | 51 | attaches: { [ attachName: string ]: any | any[] }, |
52 | statusCodeExpected?: number | 52 | statusCodeExpected?: number |
53 | }) { | 53 | }) { |
54 | if (!options.statusCodeExpected) options.statusCodeExpected = 400 | 54 | if (!options.statusCodeExpected) options.statusCodeExpected = 400 |
@@ -78,7 +78,11 @@ function makeUploadRequest (options: { | |||
78 | 78 | ||
79 | Object.keys(options.attaches).forEach(attach => { | 79 | Object.keys(options.attaches).forEach(attach => { |
80 | const value = options.attaches[attach] | 80 | const value = options.attaches[attach] |
81 | req.attach(attach, buildAbsoluteFixturePath(value)) | 81 | if (Array.isArray(value)) { |
82 | req.attach(attach, buildAbsoluteFixturePath(value[0]), value[1]) | ||
83 | } else { | ||
84 | req.attach(attach, buildAbsoluteFixturePath(value)) | ||
85 | } | ||
82 | }) | 86 | }) |
83 | 87 | ||
84 | return req.expect(options.statusCodeExpected) | 88 | return req.expect(options.statusCodeExpected) |
diff --git a/server/tests/utils/videos/video-captions.ts b/server/tests/utils/videos/video-captions.ts index 207e89632..41e52be07 100644 --- a/server/tests/utils/videos/video-captions.ts +++ b/server/tests/utils/videos/video-captions.ts | |||
@@ -10,10 +10,15 @@ function createVideoCaption (args: { | |||
10 | accessToken: string | 10 | accessToken: string |
11 | videoId: string | number | 11 | videoId: string | number |
12 | language: string | 12 | language: string |
13 | fixture: string | 13 | fixture: string, |
14 | mimeType?: string, | ||
15 | statusCodeExpected?: number | ||
14 | }) { | 16 | }) { |
15 | const path = '/api/v1/videos/' + args.videoId + '/captions/' + args.language | 17 | const path = '/api/v1/videos/' + args.videoId + '/captions/' + args.language |
16 | 18 | ||
19 | const captionfile = buildAbsoluteFixturePath(args.fixture) | ||
20 | const captionfileAttach = args.mimeType ? [ captionfile, { contentType: args.mimeType } ] : captionfile | ||
21 | |||
17 | return makeUploadRequest({ | 22 | return makeUploadRequest({ |
18 | method: 'PUT', | 23 | method: 'PUT', |
19 | url: args.url, | 24 | url: args.url, |
@@ -21,9 +26,9 @@ function createVideoCaption (args: { | |||
21 | token: args.accessToken, | 26 | token: args.accessToken, |
22 | fields: {}, | 27 | fields: {}, |
23 | attaches: { | 28 | attaches: { |
24 | captionfile: buildAbsoluteFixturePath(args.fixture) | 29 | captionfile: captionfileAttach |
25 | }, | 30 | }, |
26 | statusCodeExpected: 204 | 31 | statusCodeExpected: args.statusCodeExpected || 204 |
27 | }) | 32 | }) |
28 | } | 33 | } |
29 | 34 | ||