diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 19:07:05 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 19:07:05 +0100 |
commit | 7b1f49de22c40ae121ddb3c399b2540ba56fd414 (patch) | |
tree | 269e5dc7c2ebe4147319f1ee8e8b7f3c74549149 /server/tests/api/single-pod.js | |
parent | 4ff0d86208dafbdd07beb6286fd93c795db8a95f (diff) | |
download | PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.tar.gz PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.tar.zst PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.zip |
Server: add ability to update a video
Diffstat (limited to 'server/tests/api/single-pod.js')
-rw-r--r-- | server/tests/api/single-pod.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index 66b762f82..57146900d 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js | |||
@@ -495,10 +495,86 @@ describe('Test a single pod', function () { | |||
495 | expect(videos[2].name === 'video_short2.webm name') | 495 | expect(videos[2].name === 'video_short2.webm name') |
496 | expect(videos[3].name === 'video_short3.webm name') | 496 | expect(videos[3].name === 'video_short3.webm name') |
497 | 497 | ||
498 | videoId = videos[3].id | ||
499 | |||
498 | done() | 500 | done() |
499 | }) | 501 | }) |
500 | }) | 502 | }) |
501 | 503 | ||
504 | it('Should update a video', function (done) { | ||
505 | const name = 'my super video updated' | ||
506 | const description = 'my super description updated' | ||
507 | const tags = [ 'tagup1', 'tagup2' ] | ||
508 | |||
509 | videosUtils.updateVideo(server.url, server.accessToken, videoId, name, description, tags, done) | ||
510 | }) | ||
511 | |||
512 | it('Should have the video updated', function (done) { | ||
513 | videosUtils.getVideo(server.url, videoId, function (err, res) { | ||
514 | if (err) throw err | ||
515 | |||
516 | const video = res.body | ||
517 | |||
518 | expect(video.name).to.equal('my super video updated') | ||
519 | expect(video.description).to.equal('my super description updated') | ||
520 | expect(video.podHost).to.equal('localhost:9001') | ||
521 | expect(video.author).to.equal('root') | ||
522 | expect(video.isLocal).to.be.true | ||
523 | expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) | ||
524 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | ||
525 | |||
526 | done() | ||
527 | }) | ||
528 | }) | ||
529 | |||
530 | it('Should update only the tags of a video', function (done) { | ||
531 | const tags = [ 'tag1', 'tag2', 'supertag' ] | ||
532 | |||
533 | videosUtils.updateVideo(server.url, server.accessToken, videoId, null, null, tags, function (err) { | ||
534 | if (err) throw err | ||
535 | |||
536 | videosUtils.getVideo(server.url, videoId, function (err, res) { | ||
537 | if (err) throw err | ||
538 | |||
539 | const video = res.body | ||
540 | |||
541 | expect(video.name).to.equal('my super video updated') | ||
542 | expect(video.description).to.equal('my super description updated') | ||
543 | expect(video.podHost).to.equal('localhost:9001') | ||
544 | expect(video.author).to.equal('root') | ||
545 | expect(video.isLocal).to.be.true | ||
546 | expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ]) | ||
547 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | ||
548 | |||
549 | done() | ||
550 | }) | ||
551 | }) | ||
552 | }) | ||
553 | |||
554 | it('Should update only the description of a video', function (done) { | ||
555 | const description = 'hello everybody' | ||
556 | |||
557 | videosUtils.updateVideo(server.url, server.accessToken, videoId, null, description, null, function (err) { | ||
558 | if (err) throw err | ||
559 | |||
560 | videosUtils.getVideo(server.url, videoId, function (err, res) { | ||
561 | if (err) throw err | ||
562 | |||
563 | const video = res.body | ||
564 | |||
565 | expect(video.name).to.equal('my super video updated') | ||
566 | expect(video.description).to.equal('hello everybody') | ||
567 | expect(video.podHost).to.equal('localhost:9001') | ||
568 | expect(video.author).to.equal('root') | ||
569 | expect(video.isLocal).to.be.true | ||
570 | expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ]) | ||
571 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | ||
572 | |||
573 | done() | ||
574 | }) | ||
575 | }) | ||
576 | }) | ||
577 | |||
502 | after(function (done) { | 578 | after(function (done) { |
503 | process.kill(-server.app.pid) | 579 | process.kill(-server.app.pid) |
504 | 580 | ||