]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/users.js
Thumbnail, author and duration support in client
[github/Chocobozzz/PeerTube.git] / server / tests / api / users.js
index 506b1929959301e305e6becd8f2cf761a537b64f..cb44d26118f5be5390743e83c6649d04520c24d1 100644 (file)
@@ -12,8 +12,8 @@ const utils = require('./utils')
 
 describe('Test users', function () {
   let server = null
-  let access_token = null
-  let video_id
+  let accessToken = null
+  let videoId
 
   before(function (done) {
     this.timeout(20000)
@@ -31,6 +31,12 @@ describe('Test users', function () {
     ], done)
   })
 
+  it('Should create a new client')
+
+  it('Should return the first client')
+
+  it('Should remove the last client')
+
   it('Should not login with an invalid client id', function (done) {
     const client = { id: 'client', password: server.client.secret }
     utils.login(server.url, client, server.user, 400, function (err, res) {
@@ -72,44 +78,57 @@ describe('Test users', function () {
   })
 
   it('Should not be able to upload a video', function (done) {
-    access_token = 'mysupertoken'
-    utils.uploadVideo(server.url, access_token, 'my super name', 'my super description', 'video_short.webm', 401, done)
+    accessToken = 'mysupertoken'
+    utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 401, done)
+  })
+
+  it('Should not be able to make friends', function (done) {
+    accessToken = 'mysupertoken'
+    utils.makeFriends(server.url, accessToken, 401, done)
+  })
+
+  it('Should not be able to quit friends', function (done) {
+    accessToken = 'mysupertoken'
+    utils.quitFriends(server.url, accessToken, 401, done)
   })
 
   it('Should be able to login', function (done) {
     utils.login(server.url, server.client, server.user, 200, function (err, res) {
       if (err) throw err
 
-      access_token = res.body.access_token
+      accessToken = res.body.access_token
       done()
     })
   })
 
   it('Should upload the video with the correct token', function (done) {
-    utils.uploadVideo(server.url, access_token, 'my super name', 'my super description', 'video_short.webm', 204, function (err, res) {
+    utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 204, function (err, res) {
       if (err) throw err
 
       utils.getVideosList(server.url, function (err, res) {
         if (err) throw err
 
-        video_id = res.body[0].id
+        const video = res.body[0]
+        expect(video.author).to.equal('root')
+
+        videoId = video.id
         done()
       })
     })
   })
 
   it('Should upload the video again with the correct token', function (done) {
-    utils.uploadVideo(server.url, access_token, 'my super name 2', 'my super description 2', 'video_short.webm', 204, done)
+    utils.uploadVideo(server.url, accessToken, 'my super name 2', 'my super description 2', 'video_short.webm', 204, done)
   })
 
   it('Should not be able to remove the video with an incorrect token', function (done) {
-    utils.removeVideo(server.url, 'bad_token', video_id, 401, done)
+    utils.removeVideo(server.url, 'bad_token', videoId, 401, done)
   })
 
   it('Should not be able to remove the video with the token of another account')
 
   it('Should be able to remove the video with the correct token', function (done) {
-    utils.removeVideo(server.url, access_token, video_id, done)
+    utils.removeVideo(server.url, accessToken, videoId, done)
   })
 
   it('Should logout')