aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/multiple-servers.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-12-11 11:06:32 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-12-11 11:06:32 +0100
commitfada8d75550dc7365f7e18ee1569b9406251d660 (patch)
treedb9dc01c18693824f83fce5020f4c1f3ae7c0865 /server/tests/api/multiple-servers.ts
parent492fd28167f770d79a430fc57451b5a9e075d8e7 (diff)
parentc2830fa8f84f61462098bf36add824f89436dfa9 (diff)
downloadPeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.tar.gz
PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.tar.zst
PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.zip
Merge branch 'feature/design' into develop
Diffstat (limited to 'server/tests/api/multiple-servers.ts')
-rw-r--r--server/tests/api/multiple-servers.ts57
1 files changed, 52 insertions, 5 deletions
diff --git a/server/tests/api/multiple-servers.ts b/server/tests/api/multiple-servers.ts
index c80ded862..2f17f017a 100644
--- a/server/tests/api/multiple-servers.ts
+++ b/server/tests/api/multiple-servers.ts
@@ -2,6 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path'
6import * as request from 'supertest'
5 7
6import { 8import {
7 dateIsValid, 9 dateIsValid,
@@ -111,13 +113,14 @@ describe('Test multiple servers', function () {
111 expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ]) 113 expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
112 expect(dateIsValid(video.createdAt)).to.be.true 114 expect(dateIsValid(video.createdAt)).to.be.true
113 expect(dateIsValid(video.updatedAt)).to.be.true 115 expect(dateIsValid(video.updatedAt)).to.be.true
114 expect(video.account).to.equal('root') 116 expect(video.accountName).to.equal('root')
115 117
116 const res2 = await getVideo(server.url, video.uuid) 118 const res2 = await getVideo(server.url, video.uuid)
117 const videoDetails = res2.body 119 const videoDetails = res2.body
118 120
119 expect(videoDetails.channel.name).to.equal('my channel') 121 expect(videoDetails.channel.name).to.equal('my channel')
120 expect(videoDetails.channel.description).to.equal('super channel') 122 expect(videoDetails.channel.description).to.equal('super channel')
123 expect(videoDetails.account.name).to.equal('root')
121 expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true 124 expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true
122 expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true 125 expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true
123 expect(videoDetails.files).to.have.lengthOf(1) 126 expect(videoDetails.files).to.have.lengthOf(1)
@@ -201,7 +204,7 @@ describe('Test multiple servers', function () {
201 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) 204 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
202 expect(dateIsValid(video.createdAt)).to.be.true 205 expect(dateIsValid(video.createdAt)).to.be.true
203 expect(dateIsValid(video.updatedAt)).to.be.true 206 expect(dateIsValid(video.updatedAt)).to.be.true
204 expect(video.account).to.equal('user1') 207 expect(video.accountName).to.equal('user1')
205 208
206 if (server.url !== 'http://localhost:9002') { 209 if (server.url !== 'http://localhost:9002') {
207 expect(video.isLocal).to.be.false 210 expect(video.isLocal).to.be.false
@@ -316,7 +319,7 @@ describe('Test multiple servers', function () {
316 expect(video1.serverHost).to.equal('localhost:9003') 319 expect(video1.serverHost).to.equal('localhost:9003')
317 expect(video1.duration).to.equal(5) 320 expect(video1.duration).to.equal(5)
318 expect(video1.tags).to.deep.equal([ 'tag1p3' ]) 321 expect(video1.tags).to.deep.equal([ 'tag1p3' ])
319 expect(video1.account).to.equal('root') 322 expect(video1.accountName).to.equal('root')
320 expect(dateIsValid(video1.createdAt)).to.be.true 323 expect(dateIsValid(video1.createdAt)).to.be.true
321 expect(dateIsValid(video1.updatedAt)).to.be.true 324 expect(dateIsValid(video1.updatedAt)).to.be.true
322 325
@@ -342,7 +345,7 @@ describe('Test multiple servers', function () {
342 expect(video2.serverHost).to.equal('localhost:9003') 345 expect(video2.serverHost).to.equal('localhost:9003')
343 expect(video2.duration).to.equal(5) 346 expect(video2.duration).to.equal(5)
344 expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ]) 347 expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
345 expect(video2.account).to.equal('root') 348 expect(video2.accountName).to.equal('root')
346 expect(dateIsValid(video2.createdAt)).to.be.true 349 expect(dateIsValid(video2.createdAt)).to.be.true
347 expect(dateIsValid(video2.updatedAt)).to.be.true 350 expect(dateIsValid(video2.updatedAt)).to.be.true
348 351
@@ -690,7 +693,7 @@ describe('Test multiple servers', function () {
690 expect(baseVideo.licence).to.equal(video.licence) 693 expect(baseVideo.licence).to.equal(video.licence)
691 expect(baseVideo.category).to.equal(video.category) 694 expect(baseVideo.category).to.equal(video.category)
692 expect(baseVideo.nsfw).to.equal(video.nsfw) 695 expect(baseVideo.nsfw).to.equal(video.nsfw)
693 expect(baseVideo.account).to.equal(video.account) 696 expect(baseVideo.accountName).to.equal(video.accountName)
694 expect(baseVideo.tags).to.deep.equal(video.tags) 697 expect(baseVideo.tags).to.deep.equal(video.tags)
695 } 698 }
696 }) 699 })
@@ -706,6 +709,50 @@ describe('Test multiple servers', function () {
706 }) 709 })
707 }) 710 })
708 711
712 describe('With minimum parameters', function () {
713 it('Should upload and propagate the video', async function () {
714 this.timeout(50000)
715
716 const path = '/api/v1/videos/upload'
717
718 const req = request(servers[1].url)
719 .post(path)
720 .set('Accept', 'application/json')
721 .set('Authorization', 'Bearer ' + servers[1].accessToken)
722 .field('name', 'minimum parameters')
723 .field('privacy', '1')
724 .field('nsfw', 'false')
725 .field('channelId', '1')
726
727 const filePath = join(__dirname, '..', 'api', 'fixtures', 'video_short.webm')
728
729 await req.attach('videofile', filePath)
730 .expect(200)
731
732 await wait(25000)
733
734 for (const server of servers) {
735 const res = await getVideosList(server.url)
736 const video = res.body.data.find(v => v.name === 'minimum parameters')
737
738 expect(video.name).to.equal('minimum parameters')
739 expect(video.category).to.equal(null)
740 expect(video.categoryLabel).to.equal('Misc')
741 expect(video.licence).to.equal(null)
742 expect(video.licenceLabel).to.equal('Unknown')
743 expect(video.language).to.equal(null)
744 expect(video.languageLabel).to.equal('Unknown')
745 expect(video.nsfw).to.not.be.ok
746 expect(video.description).to.equal(null)
747 expect(video.serverHost).to.equal('localhost:9002')
748 expect(video.accountName).to.equal('root')
749 expect(video.tags).to.deep.equal([ ])
750 expect(dateIsValid(video.createdAt)).to.be.true
751 expect(dateIsValid(video.updatedAt)).to.be.true
752 }
753 })
754 })
755
709 after(async function () { 756 after(async function () {
710 killallServers(servers) 757 killallServers(servers)
711 758