diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-15 14:46:26 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-15 15:29:07 +0100 |
commit | 2422c46b27790d94fd29a7092170cee5a1b56008 (patch) | |
tree | d5c1942ce20cadb27a551d87c789edfe92f5b105 /server/tests/utils/videos | |
parent | 34cbef8c6cc912143a421413bdd832c4adcc556a (diff) | |
download | PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.gz PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.zst PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.zip |
Implement support field in video and video channel
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r-- | server/tests/utils/videos/video-channels.ts | 7 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts index 062ca8f4d..2d095d8ab 100644 --- a/server/tests/utils/videos/video-channels.ts +++ b/server/tests/utils/videos/video-channels.ts | |||
@@ -3,6 +3,7 @@ import * as request from 'supertest' | |||
3 | type VideoChannelAttributes = { | 3 | type VideoChannelAttributes = { |
4 | name?: string | 4 | name?: string |
5 | description?: string | 5 | description?: string |
6 | support?: string | ||
6 | } | 7 | } |
7 | 8 | ||
8 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { | 9 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { |
@@ -30,13 +31,14 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s | |||
30 | .expect('Content-Type', /json/) | 31 | .expect('Content-Type', /json/) |
31 | } | 32 | } |
32 | 33 | ||
33 | function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 204) { | 34 | function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200) { |
34 | const path = '/api/v1/videos/channels' | 35 | const path = '/api/v1/videos/channels' |
35 | 36 | ||
36 | // Default attributes | 37 | // Default attributes |
37 | let attributes = { | 38 | let attributes = { |
38 | name: 'my super video channel', | 39 | name: 'my super video channel', |
39 | description: 'my super channel description' | 40 | description: 'my super channel description', |
41 | support: 'my super channel support' | ||
40 | } | 42 | } |
41 | attributes = Object.assign(attributes, videoChannelAttributesArg) | 43 | attributes = Object.assign(attributes, videoChannelAttributesArg) |
42 | 44 | ||
@@ -54,6 +56,7 @@ function updateVideoChannel (url: string, token: string, channelId: number, attr | |||
54 | 56 | ||
55 | if (attributes.name) body['name'] = attributes.name | 57 | if (attributes.name) body['name'] = attributes.name |
56 | if (attributes.description) body['description'] = attributes.description | 58 | if (attributes.description) body['description'] = attributes.description |
59 | if (attributes.support) body['support'] = attributes.support | ||
57 | 60 | ||
58 | return request(url) | 61 | return request(url) |
59 | .put(path) | 62 | .put(path) |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 9a4af0b9f..a06078d40 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -248,6 +248,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg | |||
248 | channelId: defaultChannelId, | 248 | channelId: defaultChannelId, |
249 | nsfw: true, | 249 | nsfw: true, |
250 | description: 'my super description', | 250 | description: 'my super description', |
251 | support: 'my super support text', | ||
251 | tags: [ 'tag' ], | 252 | tags: [ 'tag' ], |
252 | privacy: VideoPrivacy.PUBLIC, | 253 | privacy: VideoPrivacy.PUBLIC, |
253 | commentsEnabled: true, | 254 | commentsEnabled: true, |
@@ -277,6 +278,10 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg | |||
277 | req.field('licence', attributes.licence.toString()) | 278 | req.field('licence', attributes.licence.toString()) |
278 | } | 279 | } |
279 | 280 | ||
281 | for (let i = 0; i < attributes.tags.length; i++) { | ||
282 | req.field('tags[' + i + ']', attributes.tags[i]) | ||
283 | } | ||
284 | |||
280 | if (attributes.thumbnailfile !== undefined) { | 285 | if (attributes.thumbnailfile !== undefined) { |
281 | req.attach('thumbnailfile', buildAbsoluteFixturePath(attributes.thumbnailfile)) | 286 | req.attach('thumbnailfile', buildAbsoluteFixturePath(attributes.thumbnailfile)) |
282 | } | 287 | } |
@@ -284,10 +289,6 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg | |||
284 | req.attach('previewfile', buildAbsoluteFixturePath(attributes.previewfile)) | 289 | req.attach('previewfile', buildAbsoluteFixturePath(attributes.previewfile)) |
285 | } | 290 | } |
286 | 291 | ||
287 | for (let i = 0; i < attributes.tags.length; i++) { | ||
288 | req.field('tags[' + i + ']', attributes.tags[i]) | ||
289 | } | ||
290 | |||
291 | return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture)) | 292 | return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture)) |
292 | .expect(specialStatus) | 293 | .expect(specialStatus) |
293 | } | 294 | } |
@@ -366,6 +367,7 @@ async function completeVideoCheck ( | |||
366 | nsfw: boolean | 367 | nsfw: boolean |
367 | commentsEnabled: boolean | 368 | commentsEnabled: boolean |
368 | description: string | 369 | description: string |
370 | support: string | ||
369 | host: string | 371 | host: string |
370 | account: string | 372 | account: string |
371 | isLocal: boolean, | 373 | isLocal: boolean, |