aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/videos.js')
-rw-r--r--server/tests/utils/videos.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js
index 5c120597f..beafd3cf5 100644
--- a/server/tests/utils/videos.js
+++ b/server/tests/utils/videos.js
@@ -15,7 +15,8 @@ const videosUtils = {
15 searchVideoWithPagination, 15 searchVideoWithPagination,
16 searchVideoWithSort, 16 searchVideoWithSort,
17 testVideoImage, 17 testVideoImage,
18 uploadVideo 18 uploadVideo,
19 updateVideo
19} 20}
20 21
21// ---------------------- Export functions -------------------- 22// ---------------------- Export functions --------------------
@@ -194,6 +195,31 @@ function uploadVideo (url, accessToken, name, description, tags, fixture, specia
194 .end(end) 195 .end(end)
195} 196}
196 197
198function updateVideo (url, accessToken, id, name, description, tags, specialStatus, end) {
199 if (!end) {
200 end = specialStatus
201 specialStatus = 204
202 }
203
204 const path = '/api/v1/videos/' + id
205
206 const req = request(url)
207 .put(path)
208 .set('Accept', 'application/json')
209 .set('Authorization', 'Bearer ' + accessToken)
210
211 if (name) req.field('name', name)
212 if (description) req.field('description', description)
213
214 if (tags) {
215 for (let i = 0; i < tags.length; i++) {
216 req.field('tags[' + i + ']', tags[i])
217 }
218 }
219
220 req.expect(specialStatus).end(end)
221}
222
197// --------------------------------------------------------------------------- 223// ---------------------------------------------------------------------------
198 224
199module.exports = videosUtils 225module.exports = videosUtils