aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-15 14:46:26 +0100
committerChocobozzz <me@florianbigard.com>2018-02-15 15:29:07 +0100
commit2422c46b27790d94fd29a7092170cee5a1b56008 (patch)
treed5c1942ce20cadb27a551d87c789edfe92f5b105 /server/tests/utils
parent34cbef8c6cc912143a421413bdd832c4adcc556a (diff)
downloadPeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.gz
PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.zst
PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.zip
Implement support field in video and video channel
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/users/users.ts2
-rw-r--r--server/tests/utils/videos/video-channels.ts7
-rw-r--r--server/tests/utils/videos/videos.ts10
3 files changed, 13 insertions, 6 deletions
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts
index 3c9d46246..daf731a14 100644
--- a/server/tests/utils/users/users.ts
+++ b/server/tests/utils/users/users.ts
@@ -131,6 +131,7 @@ function updateMyUser (options: {
131 displayNSFW?: boolean, 131 displayNSFW?: boolean,
132 email?: string, 132 email?: string,
133 autoPlayVideo?: boolean 133 autoPlayVideo?: boolean
134 description?: string
134}) { 135}) {
135 const path = '/api/v1/users/me' 136 const path = '/api/v1/users/me'
136 137
@@ -139,6 +140,7 @@ function updateMyUser (options: {
139 if (options.displayNSFW !== undefined && options.displayNSFW !== null) toSend['displayNSFW'] = options.displayNSFW 140 if (options.displayNSFW !== undefined && options.displayNSFW !== null) toSend['displayNSFW'] = options.displayNSFW
140 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend['autoPlayVideo'] = options.autoPlayVideo 141 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend['autoPlayVideo'] = options.autoPlayVideo
141 if (options.email !== undefined && options.email !== null) toSend['email'] = options.email 142 if (options.email !== undefined && options.email !== null) toSend['email'] = options.email
143 if (options.description !== undefined && options.description !== null) toSend['description'] = options.description
142 144
143 return makePutBodyRequest({ 145 return makePutBodyRequest({
144 url: options.url, 146 url: options.url,
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'
3type VideoChannelAttributes = { 3type VideoChannelAttributes = {
4 name?: string 4 name?: string
5 description?: string 5 description?: string
6 support?: string
6} 7}
7 8
8function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { 9function 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
33function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 204) { 34function 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,