aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-11 15:10:13 +0200
committerChocobozzz <me@florianbigard.com>2018-05-11 15:25:51 +0200
commit0f320037e689b2778959c12ddd4ce790f6e4ae4f (patch)
tree425acaa4345442388901c833275bb76b42a8a268 /server/tests/utils
parent9675333decd0b89b73a4fc67b39272f7296bfe3f (diff)
downloadPeerTube-0f320037e689b2778959c12ddd4ce790f6e4ae4f.tar.gz
PeerTube-0f320037e689b2778959c12ddd4ce790f6e4ae4f.tar.zst
PeerTube-0f320037e689b2778959c12ddd4ce790f6e4ae4f.zip
Add ability to update a video channel
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/videos/videos.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 870dfd21f..07c4ffc77 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -15,7 +15,7 @@ import {
15 ServerInfo, 15 ServerInfo,
16 testImage 16 testImage
17} from '../' 17} from '../'
18import { VideoPrivacy } from '../../../../shared/models/videos' 18import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos'
19import { readdirPromise } from '../../../helpers/core-utils' 19import { readdirPromise } from '../../../helpers/core-utils'
20import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers' 20import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers'
21import { dateIsValid, webtorrentAdd } from '../index' 21import { dateIsValid, webtorrentAdd } from '../index'
@@ -385,6 +385,7 @@ function updateVideo (url: string, accessToken: string, id: number | string, att
385 if (attributes.description) body['description'] = attributes.description 385 if (attributes.description) body['description'] = attributes.description
386 if (attributes.tags) body['tags'] = attributes.tags 386 if (attributes.tags) body['tags'] = attributes.tags
387 if (attributes.privacy) body['privacy'] = attributes.privacy 387 if (attributes.privacy) body['privacy'] = attributes.privacy
388 if (attributes.channelId) body['channelId'] = attributes.channelId
388 389
389 // Upload request 390 // Upload request
390 if (attributes.thumbnailfile || attributes.previewfile) { 391 if (attributes.thumbnailfile || attributes.previewfile) {
@@ -489,6 +490,8 @@ async function completeVideoCheck (
489 expect(video.account.uuid).to.be.a('string') 490 expect(video.account.uuid).to.be.a('string')
490 expect(video.account.host).to.equal(attributes.account.host) 491 expect(video.account.host).to.equal(attributes.account.host)
491 expect(video.account.name).to.equal(attributes.account.name) 492 expect(video.account.name).to.equal(attributes.account.name)
493 expect(video.channel.displayName).to.equal(attributes.channel.name)
494 expect(video.channel.name).to.have.lengthOf(36)
492 expect(video.likes).to.equal(attributes.likes) 495 expect(video.likes).to.equal(attributes.likes)
493 expect(video.dislikes).to.equal(attributes.dislikes) 496 expect(video.dislikes).to.equal(attributes.dislikes)
494 expect(video.isLocal).to.equal(attributes.isLocal) 497 expect(video.isLocal).to.equal(attributes.isLocal)
@@ -498,19 +501,19 @@ async function completeVideoCheck (
498 expect(dateIsValid(video.updatedAt)).to.be.true 501 expect(dateIsValid(video.updatedAt)).to.be.true
499 502
500 const res = await getVideo(url, video.uuid) 503 const res = await getVideo(url, video.uuid)
501 const videoDetails = res.body 504 const videoDetails: VideoDetails = res.body
502 505
503 expect(videoDetails.files).to.have.lengthOf(attributes.files.length) 506 expect(videoDetails.files).to.have.lengthOf(attributes.files.length)
504 expect(videoDetails.tags).to.deep.equal(attributes.tags) 507 expect(videoDetails.tags).to.deep.equal(attributes.tags)
505 expect(videoDetails.account.name).to.equal(attributes.account.name) 508 expect(videoDetails.account.name).to.equal(attributes.account.name)
506 expect(videoDetails.account.host).to.equal(attributes.account.host) 509 expect(videoDetails.account.host).to.equal(attributes.account.host)
507 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
508
509 expect(videoDetails.channel.displayName).to.equal(attributes.channel.name) 510 expect(videoDetails.channel.displayName).to.equal(attributes.channel.name)
510 expect(videoDetails.channel.name).to.have.lengthOf(36) 511 expect(videoDetails.channel.name).to.have.lengthOf(36)
512 expect(videoDetails.channel.host).to.equal(attributes.account.host)
511 expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal) 513 expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal)
512 expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true 514 expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true
513 expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true 515 expect(dateIsValid(videoDetails.channel.updatedAt.toString())).to.be.true
516 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
514 517
515 for (const attributeFile of attributes.files) { 518 for (const attributeFile of attributes.files) {
516 const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution) 519 const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution)