aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/single-pod.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-26 18:39:01 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-26 18:39:01 +0200
commitb4c5ac97ffa3e16f837b7e2d72291656eefac812 (patch)
treebebc031f07e4a4d6cea370690b696f10273d9b47 /server/tests/api/single-pod.js
parentf6e692f5ee2a0e8e1fcb75df1949b354a014ad50 (diff)
downloadPeerTube-b4c5ac97ffa3e16f837b7e2d72291656eefac812.tar.gz
PeerTube-b4c5ac97ffa3e16f837b7e2d72291656eefac812.tar.zst
PeerTube-b4c5ac97ffa3e16f837b7e2d72291656eefac812.zip
Server: refractoring upload/update video test utils
Diffstat (limited to 'server/tests/api/single-pod.js')
-rw-r--r--server/tests/api/single-pod.js51
1 files changed, 29 insertions, 22 deletions
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js
index d583592d8..9465f6034 100644
--- a/server/tests/api/single-pod.js
+++ b/server/tests/api/single-pod.js
@@ -70,13 +70,12 @@ describe('Test a single pod', function () {
70 }) 70 })
71 71
72 it('Should upload the video', function (done) { 72 it('Should upload the video', function (done) {
73 this.timeout(5000) 73 const videoAttributes = {
74 const name = 'my super name' 74 name: 'my super name',
75 const description = 'my super description' 75 category: 2,
76 const category = 2 76 tags: [ 'tag1', 'tag2', 'tag3' ]
77 const tags = [ 'tag1', 'tag2', 'tag3' ] 77 }
78 const file = 'video_short.webm' 78 videosUtils.uploadVideo(server.url, server.accessToken, videoAttributes, done)
79 videosUtils.uploadVideo(server.url, server.accessToken, name, category, description, tags, file, done)
80 }) 79 })
81 80
82 it('Should seed the uploaded video', function (done) { 81 it('Should seed the uploaded video', function (done) {
@@ -321,12 +320,15 @@ describe('Test a single pod', function () {
321 'video_short1.webm', 'video_short2.webm', 'video_short3.webm' 320 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
322 ] 321 ]
323 each(videos, function (video, callbackEach) { 322 each(videos, function (video, callbackEach) {
324 const name = video + ' name' 323 const videoAttributes = {
325 const description = video + ' description' 324 name: video + ' name',
326 const category = 2 325 description: video + ' description',
327 const tags = [ 'tag1', 'tag2', 'tag3' ] 326 category: 2,
327 tags: [ 'tag1', 'tag2', 'tag3' ],
328 fixture: video
329 }
328 330
329 videosUtils.uploadVideo(server.url, server.accessToken, name, category, description, tags, video, callbackEach) 331 videosUtils.uploadVideo(server.url, server.accessToken, videoAttributes, callbackEach)
330 }, done) 332 }, done)
331 }) 333 })
332 334
@@ -543,12 +545,13 @@ describe('Test a single pod', function () {
543 }) 545 })
544 546
545 it('Should update a video', function (done) { 547 it('Should update a video', function (done) {
546 const name = 'my super video updated' 548 const attributes = {
547 const category = 4 549 name: 'my super video updated',
548 const description = 'my super description updated' 550 category: 4,
549 const tags = [ 'tagup1', 'tagup2' ] 551 description: 'my super description updated',
550 552 tags: [ 'tagup1', 'tagup2' ]
551 videosUtils.updateVideo(server.url, server.accessToken, videoId, name, category, description, tags, done) 553 }
554 videosUtils.updateVideo(server.url, server.accessToken, videoId, attributes, done)
552 }) 555 })
553 556
554 it('Should have the video updated', function (done) { 557 it('Should have the video updated', function (done) {
@@ -586,9 +589,11 @@ describe('Test a single pod', function () {
586 }) 589 })
587 590
588 it('Should update only the tags of a video', function (done) { 591 it('Should update only the tags of a video', function (done) {
589 const tags = [ 'tag1', 'tag2', 'supertag' ] 592 const attributes = {
593 tags: [ 'tag1', 'tag2', 'supertag' ]
594 }
590 595
591 videosUtils.updateVideo(server.url, server.accessToken, videoId, null, null, null, tags, function (err) { 596 videosUtils.updateVideo(server.url, server.accessToken, videoId, attributes, function (err) {
592 if (err) throw err 597 if (err) throw err
593 598
594 videosUtils.getVideo(server.url, videoId, function (err, res) { 599 videosUtils.getVideo(server.url, videoId, function (err, res) {
@@ -613,9 +618,11 @@ describe('Test a single pod', function () {
613 }) 618 })
614 619
615 it('Should update only the description of a video', function (done) { 620 it('Should update only the description of a video', function (done) {
616 const description = 'hello everybody' 621 const attributes = {
622 description: 'hello everybody'
623 }
617 624
618 videosUtils.updateVideo(server.url, server.accessToken, videoId, null, null, description, null, function (err) { 625 videosUtils.updateVideo(server.url, server.accessToken, videoId, attributes, function (err) {
619 if (err) throw err 626 if (err) throw err
620 627
621 videosUtils.getVideo(server.url, videoId, function (err, res) { 628 videosUtils.getVideo(server.url, videoId, function (err, res) {