aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/single-pod.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-17 11:35:10 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commitafffe98839db7ccbfa9fb8b7d1413b97900fdc73 (patch)
treef0b3cbe58f73e81a5ba4bb31dabd9691994cf2ca /server/tests/api/single-pod.ts
parent1b3989b0961d22a5a45ad16239e3c3f58f66180c (diff)
downloadPeerTube-afffe98839db7ccbfa9fb8b7d1413b97900fdc73.tar.gz
PeerTube-afffe98839db7ccbfa9fb8b7d1413b97900fdc73.tar.zst
PeerTube-afffe98839db7ccbfa9fb8b7d1413b97900fdc73.zip
Speed up activity pub http requests
Diffstat (limited to 'server/tests/api/single-pod.ts')
-rw-r--r--server/tests/api/single-pod.ts47
1 files changed, 25 insertions, 22 deletions
diff --git a/server/tests/api/single-pod.ts b/server/tests/api/single-pod.ts
index 3a05d0727..0a917f2ae 100644
--- a/server/tests/api/single-pod.ts
+++ b/server/tests/api/single-pod.ts
@@ -125,8 +125,8 @@ describe('Test a single pod', function () {
125 expect(video.languageLabel).to.equal('Mandarin') 125 expect(video.languageLabel).to.equal('Mandarin')
126 expect(video.nsfw).to.be.ok 126 expect(video.nsfw).to.be.ok
127 expect(video.description).to.equal('my super description') 127 expect(video.description).to.equal('my super description')
128 expect(video.podHost).to.equal('localhost:9001') 128 expect(video.serverHost).to.equal('localhost:9001')
129 expect(video.author).to.equal('root') 129 expect(video.account).to.equal('root')
130 expect(video.isLocal).to.be.true 130 expect(video.isLocal).to.be.true
131 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 131 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
132 expect(dateIsValid(video.createdAt)).to.be.true 132 expect(dateIsValid(video.createdAt)).to.be.true
@@ -174,8 +174,8 @@ describe('Test a single pod', function () {
174 expect(video.languageLabel).to.equal('Mandarin') 174 expect(video.languageLabel).to.equal('Mandarin')
175 expect(video.nsfw).to.be.ok 175 expect(video.nsfw).to.be.ok
176 expect(video.description).to.equal('my super description') 176 expect(video.description).to.equal('my super description')
177 expect(video.podHost).to.equal('localhost:9001') 177 expect(video.serverHost).to.equal('localhost:9001')
178 expect(video.author).to.equal('root') 178 expect(video.account).to.equal('root')
179 expect(video.isLocal).to.be.true 179 expect(video.isLocal).to.be.true
180 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 180 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
181 expect(dateIsValid(video.createdAt)).to.be.true 181 expect(dateIsValid(video.createdAt)).to.be.true
@@ -237,8 +237,8 @@ describe('Test a single pod', function () {
237 expect(video.languageLabel).to.equal('Mandarin') 237 expect(video.languageLabel).to.equal('Mandarin')
238 expect(video.nsfw).to.be.ok 238 expect(video.nsfw).to.be.ok
239 expect(video.description).to.equal('my super description') 239 expect(video.description).to.equal('my super description')
240 expect(video.podHost).to.equal('localhost:9001') 240 expect(video.serverHost).to.equal('localhost:9001')
241 expect(video.author).to.equal('root') 241 expect(video.account).to.equal('root')
242 expect(video.isLocal).to.be.true 242 expect(video.isLocal).to.be.true
243 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 243 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
244 expect(dateIsValid(video.createdAt)).to.be.true 244 expect(dateIsValid(video.createdAt)).to.be.true
@@ -249,7 +249,7 @@ describe('Test a single pod', function () {
249 }) 249 })
250 250
251 // Not implemented yet 251 // Not implemented yet
252 // it('Should search the video by podHost', async function () { 252 // it('Should search the video by serverHost', async function () {
253 // const res = await videosUtils.searchVideo(server.url, '9001', 'host') 253 // const res = await videosUtils.searchVideo(server.url, '9001', 'host')
254 254
255 // expect(res.body.total).to.equal(1) 255 // expect(res.body.total).to.equal(1)
@@ -259,7 +259,7 @@ describe('Test a single pod', function () {
259 // const video = res.body.data[0] 259 // const video = res.body.data[0]
260 // expect(video.name).to.equal('my super name') 260 // expect(video.name).to.equal('my super name')
261 // expect(video.description).to.equal('my super description') 261 // expect(video.description).to.equal('my super description')
262 // expect(video.podHost).to.equal('localhost:9001') 262 // expect(video.serverHost).to.equal('localhost:9001')
263 // expect(video.author).to.equal('root') 263 // expect(video.author).to.equal('root')
264 // expect(video.isLocal).to.be.true 264 // expect(video.isLocal).to.be.true
265 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 265 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
@@ -291,8 +291,8 @@ describe('Test a single pod', function () {
291 expect(video.languageLabel).to.equal('Mandarin') 291 expect(video.languageLabel).to.equal('Mandarin')
292 expect(video.nsfw).to.be.ok 292 expect(video.nsfw).to.be.ok
293 expect(video.description).to.equal('my super description') 293 expect(video.description).to.equal('my super description')
294 expect(video.podHost).to.equal('localhost:9001') 294 expect(video.serverHost).to.equal('localhost:9001')
295 expect(video.author).to.equal('root') 295 expect(video.account).to.equal('root')
296 expect(video.isLocal).to.be.true 296 expect(video.isLocal).to.be.true
297 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 297 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
298 expect(dateIsValid(video.createdAt)).to.be.true 298 expect(dateIsValid(video.createdAt)).to.be.true
@@ -311,7 +311,7 @@ describe('Test a single pod', function () {
311 }) 311 })
312 312
313 it('Should not find a search by author', async function () { 313 it('Should not find a search by author', async function () {
314 const res = await searchVideo(server.url, 'hello', 'author') 314 const res = await searchVideo(server.url, 'hello', 'account')
315 315
316 expect(res.body.total).to.equal(0) 316 expect(res.body.total).to.equal(0)
317 expect(res.body.data).to.be.an('array') 317 expect(res.body.data).to.be.an('array')
@@ -352,7 +352,7 @@ describe('Test a single pod', function () {
352 'video_short1.webm', 'video_short2.webm', 'video_short3.webm' 352 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
353 ] 353 ]
354 354
355 const tasks: Promise<any>[] = [] 355 // const tasks: Promise<any>[] = []
356 for (const video of videos) { 356 for (const video of videos) {
357 const videoAttributes = { 357 const videoAttributes = {
358 name: video + ' name', 358 name: video + ' name',
@@ -366,10 +366,13 @@ describe('Test a single pod', function () {
366 } 366 }
367 367
368 const p = uploadVideo(server.url, server.accessToken, videoAttributes) 368 const p = uploadVideo(server.url, server.accessToken, videoAttributes)
369 tasks.push(p) 369 await p
370 } 370 }
371 371 // FIXME: concurrent uploads does not work :(
372 await Promise.all(tasks) 372 // tasks.push(p)
373 // }
374 //
375 // await Promise.all(tasks)
373 }) 376 })
374 377
375 it('Should have the correct durations', async function () { 378 it('Should have the correct durations', async function () {
@@ -462,7 +465,7 @@ describe('Test a single pod', function () {
462 }) 465 })
463 466
464 it('Should search all the root author videos', async function () { 467 it('Should search all the root author videos', async function () {
465 const res = await searchVideoWithPagination(server.url, 'root', 'author', 0, 15) 468 const res = await searchVideoWithPagination(server.url, 'root', 'account', 0, 15)
466 469
467 const videos = res.body.data 470 const videos = res.body.data
468 expect(res.body.total).to.equal(6) 471 expect(res.body.total).to.equal(6)
@@ -550,8 +553,8 @@ describe('Test a single pod', function () {
550 expect(video.languageLabel).to.equal('Arabic') 553 expect(video.languageLabel).to.equal('Arabic')
551 expect(video.nsfw).to.be.ok 554 expect(video.nsfw).to.be.ok
552 expect(video.description).to.equal('my super description updated') 555 expect(video.description).to.equal('my super description updated')
553 expect(video.podHost).to.equal('localhost:9001') 556 expect(video.serverHost).to.equal('localhost:9001')
554 expect(video.author).to.equal('root') 557 expect(video.account).to.equal('root')
555 expect(video.isLocal).to.be.true 558 expect(video.isLocal).to.be.true
556 expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) 559 expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
557 expect(dateIsValid(video.createdAt)).to.be.true 560 expect(dateIsValid(video.createdAt)).to.be.true
@@ -599,8 +602,8 @@ describe('Test a single pod', function () {
599 expect(video.languageLabel).to.equal('Arabic') 602 expect(video.languageLabel).to.equal('Arabic')
600 expect(video.nsfw).to.be.ok 603 expect(video.nsfw).to.be.ok
601 expect(video.description).to.equal('my super description updated') 604 expect(video.description).to.equal('my super description updated')
602 expect(video.podHost).to.equal('localhost:9001') 605 expect(video.serverHost).to.equal('localhost:9001')
603 expect(video.author).to.equal('root') 606 expect(video.account).to.equal('root')
604 expect(video.isLocal).to.be.true 607 expect(video.isLocal).to.be.true
605 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ]) 608 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ])
606 expect(dateIsValid(video.createdAt)).to.be.true 609 expect(dateIsValid(video.createdAt)).to.be.true
@@ -639,8 +642,8 @@ describe('Test a single pod', function () {
639 expect(video.languageLabel).to.equal('Arabic') 642 expect(video.languageLabel).to.equal('Arabic')
640 expect(video.nsfw).to.be.ok 643 expect(video.nsfw).to.be.ok
641 expect(video.description).to.equal('hello everybody') 644 expect(video.description).to.equal('hello everybody')
642 expect(video.podHost).to.equal('localhost:9001') 645 expect(video.serverHost).to.equal('localhost:9001')
643 expect(video.author).to.equal('root') 646 expect(video.account).to.equal('root')
644 expect(video.isLocal).to.be.true 647 expect(video.isLocal).to.be.true
645 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ]) 648 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ])
646 expect(dateIsValid(video.createdAt)).to.be.true 649 expect(dateIsValid(video.createdAt)).to.be.true