aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/config.js12
-rw-r--r--server/tests/api/multiple-pods.js10
-rw-r--r--server/tests/api/single-pod.js14
-rw-r--r--server/tests/api/users.js18
4 files changed, 25 insertions, 29 deletions
diff --git a/server/tests/api/config.js b/server/tests/api/config.js
index f2c00f85a..052b3f036 100644
--- a/server/tests/api/config.js
+++ b/server/tests/api/config.js
@@ -44,19 +44,15 @@ describe('Test config', function () {
44 it('Should have a correct config on a server with registration enabled and a users limit', function (done) { 44 it('Should have a correct config on a server with registration enabled and a users limit', function (done) {
45 series([ 45 series([
46 function (next) { 46 function (next) {
47 usersUtils.registerUser(server.url, 'user1', 'super password', done) 47 usersUtils.registerUser(server.url, 'user1', 'super password', next)
48 }, 48 },
49 49
50 function (next) { 50 function (next) {
51 usersUtils.registerUser(server.url, 'user2', 'super password', done) 51 usersUtils.registerUser(server.url, 'user2', 'super password', next)
52 }, 52 },
53 53
54 function (next) { 54 function (next) {
55 usersUtils.registerUser(server.url, 'user3', 'super password', done) 55 usersUtils.registerUser(server.url, 'user3', 'super password', next)
56 },
57
58 function (next) {
59 usersUtils.registerUser(server.url, 'user4', 'super password', done)
60 } 56 }
61 57
62 ], function (err) { 58 ], function (err) {
@@ -67,7 +63,7 @@ describe('Test config', function () {
67 63
68 const data = res.body 64 const data = res.body
69 65
70 expect(data.signup.allowed).to.be.truthy 66 expect(data.signup.allowed).to.be.false
71 67
72 done() 68 done()
73 }) 69 })
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js
index 7753e6f2d..abbc2caf4 100644
--- a/server/tests/api/multiple-pods.js
+++ b/server/tests/api/multiple-pods.js
@@ -118,7 +118,7 @@ describe('Test multiple pods', function () {
118 expect(video.licenceLabel).to.equal('Attribution - Non Commercial') 118 expect(video.licenceLabel).to.equal('Attribution - Non Commercial')
119 expect(video.language).to.equal(9) 119 expect(video.language).to.equal(9)
120 expect(video.languageLabel).to.equal('Japanese') 120 expect(video.languageLabel).to.equal('Japanese')
121 expect(video.nsfw).to.be.truthy 121 expect(video.nsfw).to.be.ok
122 expect(video.description).to.equal('my super description for pod 1') 122 expect(video.description).to.equal('my super description for pod 1')
123 expect(video.podHost).to.equal('localhost:9001') 123 expect(video.podHost).to.equal('localhost:9001')
124 expect(video.magnetUri).to.exist 124 expect(video.magnetUri).to.exist
@@ -195,7 +195,7 @@ describe('Test multiple pods', function () {
195 expect(video.licenceLabel).to.equal('Attribution - No Derivatives') 195 expect(video.licenceLabel).to.equal('Attribution - No Derivatives')
196 expect(video.language).to.equal(11) 196 expect(video.language).to.equal(11)
197 expect(video.languageLabel).to.equal('German') 197 expect(video.languageLabel).to.equal('German')
198 expect(video.nsfw).to.be.falsy 198 expect(video.nsfw).to.be.true
199 expect(video.description).to.equal('my super description for pod 2') 199 expect(video.description).to.equal('my super description for pod 2')
200 expect(video.podHost).to.equal('localhost:9002') 200 expect(video.podHost).to.equal('localhost:9002')
201 expect(video.magnetUri).to.exist 201 expect(video.magnetUri).to.exist
@@ -294,7 +294,7 @@ describe('Test multiple pods', function () {
294 expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike') 294 expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike')
295 expect(video1.language).to.equal(11) 295 expect(video1.language).to.equal(11)
296 expect(video1.languageLabel).to.equal('German') 296 expect(video1.languageLabel).to.equal('German')
297 expect(video1.nsfw).to.be.truthy 297 expect(video1.nsfw).to.be.ok
298 expect(video1.description).to.equal('my super description for pod 3') 298 expect(video1.description).to.equal('my super description for pod 3')
299 expect(video1.podHost).to.equal('localhost:9003') 299 expect(video1.podHost).to.equal('localhost:9003')
300 expect(video1.magnetUri).to.exist 300 expect(video1.magnetUri).to.exist
@@ -311,7 +311,7 @@ describe('Test multiple pods', function () {
311 expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 311 expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
312 expect(video2.language).to.equal(12) 312 expect(video2.language).to.equal(12)
313 expect(video2.languageLabel).to.equal('Korean') 313 expect(video2.languageLabel).to.equal('Korean')
314 expect(video2.nsfw).to.be.falsy 314 expect(video2.nsfw).to.be.false
315 expect(video2.description).to.equal('my super description for pod 3-2') 315 expect(video2.description).to.equal('my super description for pod 3-2')
316 expect(video2.podHost).to.equal('localhost:9003') 316 expect(video2.podHost).to.equal('localhost:9003')
317 expect(video2.magnetUri).to.exist 317 expect(video2.magnetUri).to.exist
@@ -695,7 +695,7 @@ describe('Test multiple pods', function () {
695 expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication') 695 expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication')
696 expect(videoUpdated.language).to.equal(13) 696 expect(videoUpdated.language).to.equal(13)
697 expect(videoUpdated.languageLabel).to.equal('French') 697 expect(videoUpdated.languageLabel).to.equal('French')
698 expect(videoUpdated.nsfw).to.be.truthy 698 expect(videoUpdated.nsfw).to.be.ok
699 expect(videoUpdated.description).to.equal('my super description updated') 699 expect(videoUpdated.description).to.equal('my super description updated')
700 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) 700 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
701 expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true 701 expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js
index 0dac9a183..1258e7e55 100644
--- a/server/tests/api/single-pod.js
+++ b/server/tests/api/single-pod.js
@@ -126,7 +126,7 @@ describe('Test a single pod', function () {
126 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 126 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
127 expect(video.language).to.equal(3) 127 expect(video.language).to.equal(3)
128 expect(video.languageLabel).to.equal('Mandarin') 128 expect(video.languageLabel).to.equal('Mandarin')
129 expect(video.nsfw).to.be.truthy 129 expect(video.nsfw).to.be.ok
130 expect(video.description).to.equal('my super description') 130 expect(video.description).to.equal('my super description')
131 expect(video.podHost).to.equal('localhost:9001') 131 expect(video.podHost).to.equal('localhost:9001')
132 expect(video.magnetUri).to.exist 132 expect(video.magnetUri).to.exist
@@ -169,7 +169,7 @@ describe('Test a single pod', function () {
169 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 169 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
170 expect(video.language).to.equal(3) 170 expect(video.language).to.equal(3)
171 expect(video.languageLabel).to.equal('Mandarin') 171 expect(video.languageLabel).to.equal('Mandarin')
172 expect(video.nsfw).to.be.truthy 172 expect(video.nsfw).to.be.ok
173 expect(video.description).to.equal('my super description') 173 expect(video.description).to.equal('my super description')
174 expect(video.podHost).to.equal('localhost:9001') 174 expect(video.podHost).to.equal('localhost:9001')
175 expect(video.magnetUri).to.exist 175 expect(video.magnetUri).to.exist
@@ -231,7 +231,7 @@ describe('Test a single pod', function () {
231 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 231 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
232 expect(video.language).to.equal(3) 232 expect(video.language).to.equal(3)
233 expect(video.languageLabel).to.equal('Mandarin') 233 expect(video.languageLabel).to.equal('Mandarin')
234 expect(video.nsfw).to.be.truthy 234 expect(video.nsfw).to.be.ok
235 expect(video.description).to.equal('my super description') 235 expect(video.description).to.equal('my super description')
236 expect(video.podHost).to.equal('localhost:9001') 236 expect(video.podHost).to.equal('localhost:9001')
237 expect(video.author).to.equal('root') 237 expect(video.author).to.equal('root')
@@ -293,7 +293,7 @@ describe('Test a single pod', function () {
293 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 293 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
294 expect(video.language).to.equal(3) 294 expect(video.language).to.equal(3)
295 expect(video.languageLabel).to.equal('Mandarin') 295 expect(video.languageLabel).to.equal('Mandarin')
296 expect(video.nsfw).to.be.truthy 296 expect(video.nsfw).to.be.ok
297 expect(video.description).to.equal('my super description') 297 expect(video.description).to.equal('my super description')
298 expect(video.podHost).to.equal('localhost:9001') 298 expect(video.podHost).to.equal('localhost:9001')
299 expect(video.author).to.equal('root') 299 expect(video.author).to.equal('root')
@@ -641,7 +641,7 @@ describe('Test a single pod', function () {
641 expect(video.licenceLabel).to.equal('Attribution - Share Alike') 641 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
642 expect(video.language).to.equal(5) 642 expect(video.language).to.equal(5)
643 expect(video.languageLabel).to.equal('Arabic') 643 expect(video.languageLabel).to.equal('Arabic')
644 expect(video.nsfw).to.be.truthy 644 expect(video.nsfw).to.be.ok
645 expect(video.description).to.equal('my super description updated') 645 expect(video.description).to.equal('my super description updated')
646 expect(video.podHost).to.equal('localhost:9001') 646 expect(video.podHost).to.equal('localhost:9001')
647 expect(video.author).to.equal('root') 647 expect(video.author).to.equal('root')
@@ -685,7 +685,7 @@ describe('Test a single pod', function () {
685 expect(video.licenceLabel).to.equal('Attribution - Share Alike') 685 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
686 expect(video.language).to.equal(5) 686 expect(video.language).to.equal(5)
687 expect(video.languageLabel).to.equal('Arabic') 687 expect(video.languageLabel).to.equal('Arabic')
688 expect(video.nsfw).to.be.truthy 688 expect(video.nsfw).to.be.ok
689 expect(video.description).to.equal('my super description updated') 689 expect(video.description).to.equal('my super description updated')
690 expect(video.podHost).to.equal('localhost:9001') 690 expect(video.podHost).to.equal('localhost:9001')
691 expect(video.author).to.equal('root') 691 expect(video.author).to.equal('root')
@@ -719,7 +719,7 @@ describe('Test a single pod', function () {
719 expect(video.licenceLabel).to.equal('Attribution - Share Alike') 719 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
720 expect(video.language).to.equal(5) 720 expect(video.language).to.equal(5)
721 expect(video.languageLabel).to.equal('Arabic') 721 expect(video.languageLabel).to.equal('Arabic')
722 expect(video.nsfw).to.be.truthy 722 expect(video.nsfw).to.be.ok
723 expect(video.description).to.equal('hello everybody') 723 expect(video.description).to.equal('hello everybody')
724 expect(video.podHost).to.equal('localhost:9001') 724 expect(video.podHost).to.equal('localhost:9001')
725 expect(video.author).to.equal('root') 725 expect(video.author).to.equal('root')
diff --git a/server/tests/api/users.js b/server/tests/api/users.js
index 74477ae2d..dacecf295 100644
--- a/server/tests/api/users.js
+++ b/server/tests/api/users.js
@@ -209,7 +209,7 @@ describe('Test users', function () {
209 209
210 expect(user.username).to.equal('user_1') 210 expect(user.username).to.equal('user_1')
211 expect(user.email).to.equal('user_1@example.com') 211 expect(user.email).to.equal('user_1@example.com')
212 expect(user.displayNSFW).to.be.falsy 212 expect(user.displayNSFW).to.be.false
213 expect(user.id).to.exist 213 expect(user.id).to.exist
214 214
215 done() 215 done()
@@ -238,12 +238,12 @@ describe('Test users', function () {
238 const user = users[0] 238 const user = users[0]
239 expect(user.username).to.equal('user_1') 239 expect(user.username).to.equal('user_1')
240 expect(user.email).to.equal('user_1@example.com') 240 expect(user.email).to.equal('user_1@example.com')
241 expect(user.displayNSFW).to.be.falsy 241 expect(user.displayNSFW).to.be.false
242 242
243 const rootUser = users[1] 243 const rootUser = users[1]
244 expect(rootUser.username).to.equal('root') 244 expect(rootUser.username).to.equal('root')
245 expect(rootUser.email).to.equal('admin1@example.com') 245 expect(rootUser.email).to.equal('admin1@example.com')
246 expect(rootUser.displayNSFW).to.be.falsy 246 expect(rootUser.displayNSFW).to.be.false
247 247
248 userId = user.id 248 userId = user.id
249 249
@@ -265,7 +265,7 @@ describe('Test users', function () {
265 const user = users[0] 265 const user = users[0]
266 expect(user.username).to.equal('root') 266 expect(user.username).to.equal('root')
267 expect(user.email).to.equal('admin1@example.com') 267 expect(user.email).to.equal('admin1@example.com')
268 expect(user.displayNSFW).to.be.falsy 268 expect(user.displayNSFW).to.be.false
269 269
270 done() 270 done()
271 }) 271 })
@@ -285,7 +285,7 @@ describe('Test users', function () {
285 const user = users[0] 285 const user = users[0]
286 expect(user.username).to.equal('user_1') 286 expect(user.username).to.equal('user_1')
287 expect(user.email).to.equal('user_1@example.com') 287 expect(user.email).to.equal('user_1@example.com')
288 expect(user.displayNSFW).to.be.falsy 288 expect(user.displayNSFW).to.be.false
289 289
290 done() 290 done()
291 }) 291 })
@@ -305,7 +305,7 @@ describe('Test users', function () {
305 const user = users[0] 305 const user = users[0]
306 expect(user.username).to.equal('user_1') 306 expect(user.username).to.equal('user_1')
307 expect(user.email).to.equal('user_1@example.com') 307 expect(user.email).to.equal('user_1@example.com')
308 expect(user.displayNSFW).to.be.falsy 308 expect(user.displayNSFW).to.be.false
309 309
310 done() 310 done()
311 }) 311 })
@@ -324,11 +324,11 @@ describe('Test users', function () {
324 324
325 expect(users[0].username).to.equal('root') 325 expect(users[0].username).to.equal('root')
326 expect(users[0].email).to.equal('admin1@example.com') 326 expect(users[0].email).to.equal('admin1@example.com')
327 expect(users[0].displayNSFW).to.be.falsy 327 expect(users[0].displayNSFW).to.be.false
328 328
329 expect(users[1].username).to.equal('user_1') 329 expect(users[1].username).to.equal('user_1')
330 expect(users[1].email).to.equal('user_1@example.com') 330 expect(users[1].email).to.equal('user_1@example.com')
331 expect(users[1].displayNSFW).to.be.falsy 331 expect(users[1].displayNSFW).to.be.false
332 332
333 done() 333 done()
334 }) 334 })
@@ -354,7 +354,7 @@ describe('Test users', function () {
354 354
355 expect(user.username).to.equal('user_1') 355 expect(user.username).to.equal('user_1')
356 expect(user.email).to.equal('user_1@example.com') 356 expect(user.email).to.equal('user_1@example.com')
357 expect(user.displayNSFW).to.be.truthy 357 expect(user.displayNSFW).to.be.ok
358 expect(user.id).to.exist 358 expect(user.id).to.exist
359 359
360 done() 360 done()