aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/checkParams.js28
-rw-r--r--server/tests/api/friendsAdvanced.js2
-rw-r--r--server/tests/api/multiplePods.js8
-rw-r--r--server/tests/api/singlePod.js7
4 files changed, 23 insertions, 22 deletions
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js
index 71113fd39..1f47e5ef4 100644
--- a/server/tests/api/checkParams.js
+++ b/server/tests/api/checkParams.js
@@ -59,7 +59,7 @@ describe('Test parameters validator', function () {
59 function (next) { 59 function (next) {
60 utils.loginAndGetAccessToken(server, function (err, token) { 60 utils.loginAndGetAccessToken(server, function (err, token) {
61 if (err) throw err 61 if (err) throw err
62 server.access_token = token 62 server.accessToken = token
63 63
64 next() 64 next()
65 }) 65 })
@@ -138,7 +138,7 @@ describe('Test parameters validator', function () {
138 it('Should fail with nothing', function (done) { 138 it('Should fail with nothing', function (done) {
139 const data = {} 139 const data = {}
140 const attach = {} 140 const attach = {}
141 makePostRequest(path, server.access_token, data, attach, done) 141 makePostRequest(path, server.accessToken, data, attach, done)
142 }) 142 })
143 143
144 it('Should fail without name', function (done) { 144 it('Should fail without name', function (done) {
@@ -148,7 +148,7 @@ describe('Test parameters validator', function () {
148 const attach = { 148 const attach = {
149 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 149 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
150 } 150 }
151 makePostRequest(path, server.access_token, data, attach, done) 151 makePostRequest(path, server.accessToken, data, attach, done)
152 }) 152 })
153 153
154 it('Should fail with a long name', function (done) { 154 it('Should fail with a long name', function (done) {
@@ -159,7 +159,7 @@ describe('Test parameters validator', function () {
159 const attach = { 159 const attach = {
160 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 160 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
161 } 161 }
162 makePostRequest(path, server.access_token, data, attach, done) 162 makePostRequest(path, server.accessToken, data, attach, done)
163 }) 163 })
164 164
165 it('Should fail without description', function (done) { 165 it('Should fail without description', function (done) {
@@ -169,7 +169,7 @@ describe('Test parameters validator', function () {
169 const attach = { 169 const attach = {
170 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 170 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
171 } 171 }
172 makePostRequest(path, server.access_token, data, attach, done) 172 makePostRequest(path, server.accessToken, data, attach, done)
173 }) 173 })
174 174
175 it('Should fail with a long description', function (done) { 175 it('Should fail with a long description', function (done) {
@@ -182,7 +182,7 @@ describe('Test parameters validator', function () {
182 const attach = { 182 const attach = {
183 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 183 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
184 } 184 }
185 makePostRequest(path, server.access_token, data, attach, done) 185 makePostRequest(path, server.accessToken, data, attach, done)
186 }) 186 })
187 187
188 it('Should fail without an input file', function (done) { 188 it('Should fail without an input file', function (done) {
@@ -191,7 +191,7 @@ describe('Test parameters validator', function () {
191 description: 'my super description' 191 description: 'my super description'
192 } 192 }
193 const attach = {} 193 const attach = {}
194 makePostRequest(path, server.access_token, data, attach, done) 194 makePostRequest(path, server.accessToken, data, attach, done)
195 }) 195 })
196 196
197 it('Should fail without an incorrect input file', function (done) { 197 it('Should fail without an incorrect input file', function (done) {
@@ -202,7 +202,7 @@ describe('Test parameters validator', function () {
202 const attach = { 202 const attach = {
203 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') 203 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
204 } 204 }
205 makePostRequest(path, server.access_token, data, attach, done) 205 makePostRequest(path, server.accessToken, data, attach, done)
206 }) 206 })
207 207
208 it('Should succeed with the correct parameters', function (done) { 208 it('Should succeed with the correct parameters', function (done) {
@@ -213,11 +213,11 @@ describe('Test parameters validator', function () {
213 const attach = { 213 const attach = {
214 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 214 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
215 } 215 }
216 makePostRequest(path, server.access_token, data, attach, function () { 216 makePostRequest(path, server.accessToken, data, attach, function () {
217 attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') 217 attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4')
218 makePostRequest(path, server.access_token, data, attach, function () { 218 makePostRequest(path, server.accessToken, data, attach, function () {
219 attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') 219 attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv')
220 makePostRequest(path, server.access_token, data, attach, done, true) 220 makePostRequest(path, server.accessToken, data, attach, done, true)
221 }, true) 221 }, true)
222 }, true) 222 }, true)
223 }) 223 })
@@ -261,21 +261,21 @@ describe('Test parameters validator', function () {
261 it('Should have 404 with nothing', function (done) { 261 it('Should have 404 with nothing', function (done) {
262 request(server.url) 262 request(server.url)
263 .delete(path) 263 .delete(path)
264 .set('Authorization', 'Bearer ' + server.access_token) 264 .set('Authorization', 'Bearer ' + server.accessToken)
265 .expect(400, done) 265 .expect(400, done)
266 }) 266 })
267 267
268 it('Should fail without a mongodb id', function (done) { 268 it('Should fail without a mongodb id', function (done) {
269 request(server.url) 269 request(server.url)
270 .delete(path + 'hello') 270 .delete(path + 'hello')
271 .set('Authorization', 'Bearer ' + server.access_token) 271 .set('Authorization', 'Bearer ' + server.accessToken)
272 .expect(400, done) 272 .expect(400, done)
273 }) 273 })
274 274
275 it('Should fail with a video which does not exist', function (done) { 275 it('Should fail with a video which does not exist', function (done) {
276 request(server.url) 276 request(server.url)
277 .delete(path + '123456789012345678901234') 277 .delete(path + '123456789012345678901234')
278 .set('Authorization', 'Bearer ' + server.access_token) 278 .set('Authorization', 'Bearer ' + server.accessToken)
279 .expect(404, done) 279 .expect(404, done)
280 }) 280 })
281 281
diff --git a/server/tests/api/friendsAdvanced.js b/server/tests/api/friendsAdvanced.js
index 833a530dd..9bd202a05 100644
--- a/server/tests/api/friendsAdvanced.js
+++ b/server/tests/api/friendsAdvanced.js
@@ -27,7 +27,7 @@ describe('Test advanced friends', function () {
27 const fixture = 'video_short.webm' 27 const fixture = 'video_short.webm'
28 const server = servers[podNumber - 1] 28 const server = servers[podNumber - 1]
29 29
30 return utils.uploadVideo(server.url, server.access_token, name, description, fixture, callback) 30 return utils.uploadVideo(server.url, server.accessToken, name, description, fixture, callback)
31 } 31 }
32 32
33 function getVideos (podNumber, callback) { 33 function getVideos (podNumber, callback) {
diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js
index f1415f6f1..1a61034fc 100644
--- a/server/tests/api/multiplePods.js
+++ b/server/tests/api/multiplePods.js
@@ -72,7 +72,7 @@ describe('Test multiple pods', function () {
72 72
73 async.series([ 73 async.series([
74 function (next) { 74 function (next) {
75 utils.uploadVideo(servers[0].url, servers[0].access_token, 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', next) 75 utils.uploadVideo(servers[0].url, servers[0].accessToken, 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', next)
76 }, 76 },
77 function (next) { 77 function (next) {
78 setTimeout(next, 11000) 78 setTimeout(next, 11000)
@@ -127,7 +127,7 @@ describe('Test multiple pods', function () {
127 127
128 async.series([ 128 async.series([
129 function (next) { 129 function (next) {
130 utils.uploadVideo(servers[1].url, servers[1].access_token, 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', next) 130 utils.uploadVideo(servers[1].url, servers[1].accessToken, 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', next)
131 }, 131 },
132 function (next) { 132 function (next) {
133 setTimeout(next, 11000) 133 setTimeout(next, 11000)
@@ -182,10 +182,10 @@ describe('Test multiple pods', function () {
182 182
183 async.series([ 183 async.series([
184 function (next) { 184 function (next) {
185 utils.uploadVideo(servers[2].url, servers[2].access_token, 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', next) 185 utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', next)
186 }, 186 },
187 function (next) { 187 function (next) {
188 utils.uploadVideo(servers[2].url, servers[2].access_token, 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', next) 188 utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', next)
189 }, 189 },
190 function (next) { 190 function (next) {
191 setTimeout(next, 22000) 191 setTimeout(next, 22000)
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js
index 542dea430..0d0e6a82e 100644
--- a/server/tests/api/singlePod.js
+++ b/server/tests/api/singlePod.js
@@ -32,7 +32,7 @@ describe('Test a single pod', function () {
32 function (next) { 32 function (next) {
33 utils.loginAndGetAccessToken(server, function (err, token) { 33 utils.loginAndGetAccessToken(server, function (err, token) {
34 if (err) throw err 34 if (err) throw err
35 server.access_token = token 35 server.accessToken = token
36 next() 36 next()
37 }) 37 })
38 }, 38 },
@@ -55,7 +55,7 @@ describe('Test a single pod', function () {
55 55
56 it('Should upload the video', function (done) { 56 it('Should upload the video', function (done) {
57 this.timeout(5000) 57 this.timeout(5000)
58 utils.uploadVideo(server.url, server.access_token, 'my super name', 'my super description', 'video_short.webm', done) 58 utils.uploadVideo(server.url, server.accessToken, 'my super name', 'my super description', 'video_short.webm', done)
59 }) 59 })
60 60
61 it('Should seed the uploaded video', function (done) { 61 it('Should seed the uploaded video', function (done) {
@@ -87,7 +87,8 @@ describe('Test a single pod', function () {
87 expect(torrent.files.length).to.equal(1) 87 expect(torrent.files.length).to.equal(1)
88 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 88 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
89 89
90 done() 90 // We remove it because we'll add it again
91 webtorrent.remove(video.magnetUri, done)
91 }) 92 })
92 }) 93 })
93 }) 94 })