aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/videos/videos.ts')
-rw-r--r--shared/extra-utils/videos/videos.ts22
1 files changed, 19 insertions, 3 deletions
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index f94fa233c..929eb42ca 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -11,7 +11,7 @@ import validator from 'validator'
11import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' 11import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants'
12import { VideoDetails, VideoPrivacy } from '../../models/videos' 12import { VideoDetails, VideoPrivacy } from '../../models/videos'
13import { buildAbsoluteFixturePath, buildServerDirectory, dateIsValid, immutableAssign, testImage, webtorrentAdd } from '../miscs/miscs' 13import { buildAbsoluteFixturePath, buildServerDirectory, dateIsValid, immutableAssign, testImage, webtorrentAdd } from '../miscs/miscs'
14import { makeGetRequest, makePutBodyRequest, makeUploadRequest } from '../requests/requests' 14import { makeGetRequest, makePutBodyRequest, makeRawRequest, makeUploadRequest } from '../requests/requests'
15import { waitJobs } from '../server/jobs' 15import { waitJobs } from '../server/jobs'
16import { ServerInfo } from '../server/servers' 16import { ServerInfo } from '../server/servers'
17import { getMyUserInformation } from '../users/users' 17import { getMyUserInformation } from '../users/users'
@@ -544,6 +544,9 @@ async function completeVideoCheck (
544 if (!attributes.likes) attributes.likes = 0 544 if (!attributes.likes) attributes.likes = 0
545 if (!attributes.dislikes) attributes.dislikes = 0 545 if (!attributes.dislikes) attributes.dislikes = 0
546 546
547 const host = new URL(url).host
548 const originHost = attributes.account.host
549
547 expect(video.name).to.equal(attributes.name) 550 expect(video.name).to.equal(attributes.name)
548 expect(video.category.id).to.equal(attributes.category) 551 expect(video.category.id).to.equal(attributes.category)
549 expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Misc') 552 expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Misc')
@@ -603,8 +606,21 @@ async function completeVideoCheck (
603 if (attributes.files.length > 1) extension = '.mp4' 606 if (attributes.files.length > 1) extension = '.mp4'
604 607
605 expect(file.magnetUri).to.have.lengthOf.above(2) 608 expect(file.magnetUri).to.have.lengthOf.above(2)
606 expect(file.torrentUrl).to.equal(`http://${attributes.account.host}/static/torrents/${videoDetails.uuid}-${file.resolution.id}.torrent`) 609
607 expect(file.fileUrl).to.equal(`http://${attributes.account.host}/static/webseed/${videoDetails.uuid}-${file.resolution.id}${extension}`) 610 expect(file.torrentDownloadUrl).to.equal(`http://${host}/download/torrents/${videoDetails.uuid}-${file.resolution.id}.torrent`)
611 expect(file.torrentUrl).to.equal(`http://${host}/lazy-static/torrents/${videoDetails.uuid}-${file.resolution.id}.torrent`)
612
613 expect(file.fileUrl).to.equal(`http://${originHost}/static/webseed/${videoDetails.uuid}-${file.resolution.id}${extension}`)
614 expect(file.fileDownloadUrl).to.equal(`http://${originHost}/download/videos/${videoDetails.uuid}-${file.resolution.id}${extension}`)
615
616 await Promise.all([
617 makeRawRequest(file.torrentUrl, 200),
618 makeRawRequest(file.torrentDownloadUrl, 200),
619 makeRawRequest(file.metadataUrl, 200),
620 // Backward compatibility
621 makeRawRequest(`http://${originHost}/static/torrents/${videoDetails.uuid}-${file.resolution.id}.torrent`, 200)
622 ])
623
608 expect(file.resolution.id).to.equal(attributeFile.resolution) 624 expect(file.resolution.id).to.equal(attributeFile.resolution)
609 expect(file.resolution.label).to.equal(attributeFile.resolution + 'p') 625 expect(file.resolution.label).to.equal(attributeFile.resolution + 'p')
610 626