Server: add nsfw attribute
[oweals/peertube.git] / server / tests / utils / videos.js
index ad0d7407686e9767d0dcc2e3a7075feb68e12e42..3c7d99eec61de373a083d52a2afd34a7954e31f8 100644 (file)
@@ -6,6 +6,7 @@ const request = require('supertest')
 
 const videosUtils = {
   getVideoCategories,
+  getVideoLicences,
   getAllVideosListBy,
   getVideo,
   getVideosList,
@@ -34,6 +35,17 @@ function getVideoCategories (url, end) {
     .end(end)
 }
 
+function getVideoLicences (url, end) {
+  const path = '/api/v1/videos/licences'
+
+  request(url)
+    .get(path)
+    .set('Accept', 'application/json')
+    .expect(200)
+    .expect('Content-Type', /json/)
+    .end(end)
+}
+
 function getAllVideosListBy (url, end) {
   const path = '/api/v1/videos'
 
@@ -205,6 +217,8 @@ function uploadVideo (url, accessToken, videoAttributesArg, specialStatus, end)
   let attributes = {
     name: 'my super video',
     category: 5,
+    licence: 4,
+    nsfw: true,
     description: 'my super description',
     tags: [ 'tag' ],
     fixture: 'video_short.webm'
@@ -217,6 +231,8 @@ function uploadVideo (url, accessToken, videoAttributesArg, specialStatus, end)
               .set('Authorization', 'Bearer ' + accessToken)
               .field('name', attributes.name)
               .field('category', attributes.category)
+              .field('licence', attributes.licence)
+              .field('nsfw', attributes.nsfw)
               .field('description', attributes.description)
 
   for (let i = 0; i < attributes.tags.length; i++) {
@@ -250,6 +266,8 @@ function updateVideo (url, accessToken, id, attributes, specialStatus, end) {
 
   if (attributes.name) req.field('name', attributes.name)
   if (attributes.category) req.field('category', attributes.category)
+  if (attributes.licence) req.field('licence', attributes.licence)
+  if (attributes.nsfw) req.field('nsfw', attributes.nsfw)
   if (attributes.description) req.field('description', attributes.description)
 
   if (attributes.tags) {