aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/videos.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js
index 177426076..0aa6ec5a8 100644
--- a/server/tests/utils/videos.js
+++ b/server/tests/utils/videos.js
@@ -5,6 +5,7 @@ const pathUtils = require('path')
5const request = require('supertest') 5const request = require('supertest')
6 6
7const videosUtils = { 7const videosUtils = {
8 getVideoCategories,
8 getAllVideosListBy, 9 getAllVideosListBy,
9 getVideo, 10 getVideo,
10 getVideosList, 11 getVideosList,
@@ -22,6 +23,17 @@ const videosUtils = {
22 23
23// ---------------------- Export functions -------------------- 24// ---------------------- Export functions --------------------
24 25
26function getVideoCategories (url, end) {
27 const path = '/api/v1/videos/categories'
28
29 request(url)
30 .get(path)
31 .set('Accept', 'application/json')
32 .expect(200)
33 .expect('Content-Type', /json/)
34 .end(end)
35}
36
25function getAllVideosListBy (url, end) { 37function getAllVideosListBy (url, end) {
26 const path = '/api/v1/videos' 38 const path = '/api/v1/videos'
27 39
@@ -181,7 +193,7 @@ function testVideoImage (url, videoName, imagePath, callback) {
181 } 193 }
182} 194}
183 195
184function uploadVideo (url, accessToken, name, description, tags, fixture, specialStatus, end) { 196function uploadVideo (url, accessToken, name, category, description, tags, fixture, specialStatus, end) {
185 if (!end) { 197 if (!end) {
186 end = specialStatus 198 end = specialStatus
187 specialStatus = 204 199 specialStatus = 204
@@ -194,6 +206,7 @@ function uploadVideo (url, accessToken, name, description, tags, fixture, specia
194 .set('Accept', 'application/json') 206 .set('Accept', 'application/json')
195 .set('Authorization', 'Bearer ' + accessToken) 207 .set('Authorization', 'Bearer ' + accessToken)
196 .field('name', name) 208 .field('name', name)
209 .field('category', category)
197 .field('description', description) 210 .field('description', description)
198 211
199 for (let i = 0; i < tags.length; i++) { 212 for (let i = 0; i < tags.length; i++) {
@@ -212,7 +225,7 @@ function uploadVideo (url, accessToken, name, description, tags, fixture, specia
212 .end(end) 225 .end(end)
213} 226}
214 227
215function updateVideo (url, accessToken, id, name, description, tags, specialStatus, end) { 228function updateVideo (url, accessToken, id, name, category, description, tags, specialStatus, end) {
216 if (!end) { 229 if (!end) {
217 end = specialStatus 230 end = specialStatus
218 specialStatus = 204 231 specialStatus = 204
@@ -226,6 +239,7 @@ function updateVideo (url, accessToken, id, name, description, tags, specialStat
226 .set('Authorization', 'Bearer ' + accessToken) 239 .set('Authorization', 'Bearer ' + accessToken)
227 240
228 if (name) req.field('name', name) 241 if (name) req.field('name', name)
242 if (category) req.field('category', category)
229 if (description) req.field('description', description) 243 if (description) req.field('description', description)
230 244
231 if (tags) { 245 if (tags) {