aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users.js')
-rw-r--r--server/tests/api/users.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/server/tests/api/users.js b/server/tests/api/users.js
index e5395a79f..57417a69e 100644
--- a/server/tests/api/users.js
+++ b/server/tests/api/users.js
@@ -12,8 +12,8 @@ const utils = require('./utils')
12 12
13describe('Test users', function () { 13describe('Test users', function () {
14 let server = null 14 let server = null
15 let access_token = null 15 let accessToken = null
16 let video_id 16 let videoId
17 17
18 before(function (done) { 18 before(function (done) {
19 this.timeout(20000) 19 this.timeout(20000)
@@ -78,21 +78,21 @@ describe('Test users', function () {
78 }) 78 })
79 79
80 it('Should not be able to upload a video', function (done) { 80 it('Should not be able to upload a video', function (done) {
81 access_token = 'mysupertoken' 81 accessToken = 'mysupertoken'
82 utils.uploadVideo(server.url, access_token, 'my super name', 'my super description', 'video_short.webm', 401, done) 82 utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 401, done)
83 }) 83 })
84 84
85 it('Should be able to login', function (done) { 85 it('Should be able to login', function (done) {
86 utils.login(server.url, server.client, server.user, 200, function (err, res) { 86 utils.login(server.url, server.client, server.user, 200, function (err, res) {
87 if (err) throw err 87 if (err) throw err
88 88
89 access_token = res.body.access_token 89 accessToken = res.body.access_token
90 done() 90 done()
91 }) 91 })
92 }) 92 })
93 93
94 it('Should upload the video with the correct token', function (done) { 94 it('Should upload the video with the correct token', function (done) {
95 utils.uploadVideo(server.url, access_token, 'my super name', 'my super description', 'video_short.webm', 204, function (err, res) { 95 utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 204, function (err, res) {
96 if (err) throw err 96 if (err) throw err
97 97
98 utils.getVideosList(server.url, function (err, res) { 98 utils.getVideosList(server.url, function (err, res) {
@@ -101,24 +101,24 @@ describe('Test users', function () {
101 const video = res.body[0] 101 const video = res.body[0]
102 expect(video.author).to.equal('root') 102 expect(video.author).to.equal('root')
103 103
104 video_id = video.id 104 videoId = video.id
105 done() 105 done()
106 }) 106 })
107 }) 107 })
108 }) 108 })
109 109
110 it('Should upload the video again with the correct token', function (done) { 110 it('Should upload the video again with the correct token', function (done) {
111 utils.uploadVideo(server.url, access_token, 'my super name 2', 'my super description 2', 'video_short.webm', 204, done) 111 utils.uploadVideo(server.url, accessToken, 'my super name 2', 'my super description 2', 'video_short.webm', 204, done)
112 }) 112 })
113 113
114 it('Should not be able to remove the video with an incorrect token', function (done) { 114 it('Should not be able to remove the video with an incorrect token', function (done) {
115 utils.removeVideo(server.url, 'bad_token', video_id, 401, done) 115 utils.removeVideo(server.url, 'bad_token', videoId, 401, done)
116 }) 116 })
117 117
118 it('Should not be able to remove the video with the token of another account') 118 it('Should not be able to remove the video with the token of another account')
119 119
120 it('Should be able to remove the video with the correct token', function (done) { 120 it('Should be able to remove the video with the correct token', function (done) {
121 utils.removeVideo(server.url, access_token, video_id, done) 121 utils.removeVideo(server.url, accessToken, videoId, done)
122 }) 122 })
123 123
124 it('Should logout') 124 it('Should logout')