From 5d00a3d7aa4309f1da5ac7d6e3ed63181eb34952 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 19 Mar 2018 12:36:41 +0100 Subject: Update the api documentation --- server/tests/api/videos/multiple-servers.ts | 9 ++++----- server/tests/cli/update-host.ts | 5 +++-- server/tests/utils/videos/videos.ts | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 42a1241f7..74c6b8462 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -452,7 +452,7 @@ describe('Test multiple servers', function () { const res2 = await getVideo(servers[0].url, video.id) const videoDetails = res2.body - const file = videoDetails.files.find(f => f.resolution === 360) + const file = videoDetails.files.find(f => f.resolution.id === 360) expect(file).not.to.be.undefined const torrent = await webtorrentAdd(file.magnetUri) @@ -705,10 +705,9 @@ describe('Test multiple servers', function () { expect(baseVideo.name).to.equal(video.name) expect(baseVideo.uuid).to.equal(video.uuid) - expect(baseVideo.category).to.equal(video.category) - expect(baseVideo.language).to.equal(video.language) - expect(baseVideo.licence).to.equal(video.licence) - expect(baseVideo.category).to.equal(video.category) + expect(baseVideo.category.id).to.equal(video.category.id) + expect(baseVideo.language.id).to.equal(video.language.id) + expect(baseVideo.licence.id).to.equal(video.licence.id) expect(baseVideo.nsfw).to.equal(video.nsfw) expect(baseVideo.account.name).to.equal(video.account.name) expect(baseVideo.account.displayName).to.equal(video.account.displayName) diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 39242c494..ad56f7b1b 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts @@ -2,6 +2,7 @@ import 'mocha' import * as chai from 'chai' +import { VideoDetails } from '../../../shared/models/videos' const expect = chai.expect import { @@ -59,7 +60,7 @@ describe('Test update host scripts', function () { for (const video of videos) { const res2 = await getVideo(server.url, video.id) - const videoDetails = res2.body + const videoDetails: VideoDetails = res2.body expect(videoDetails.files).to.have.lengthOf(4) @@ -67,7 +68,7 @@ describe('Test update host scripts', function () { expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket') expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2Fwebseed%2F') - const torrent = await parseTorrentVideo(server, videoDetails.uuid, file.resolution) + const torrent = await parseTorrentVideo(server, videoDetails.uuid, file.resolution.id) const announceWS = torrent.announce.find(a => a === 'ws://localhost:9002/tracker/socket') expect(announceWS).to.not.be.undefined diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 3c63bedb2..424f41ed8 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -442,7 +442,7 @@ async function completeVideoCheck ( expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true for (const attributeFile of attributes.files) { - const file = videoDetails.files.find(f => f.resolution === attributeFile.resolution) + const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution) expect(file).not.to.be.undefined let extension = extname(attributes.fixture) @@ -451,8 +451,8 @@ async function completeVideoCheck ( const magnetUri = file.magnetUri expect(file.magnetUri).to.have.lengthOf.above(2) - expect(file.torrentUrl).to.equal(`http://${attributes.account.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`) - expect(file.fileUrl).to.equal(`http://${attributes.account.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`) + expect(file.torrentUrl).to.equal(`http://${attributes.account.host}/static/torrents/${videoDetails.uuid}-${file.resolution.id}.torrent`) + expect(file.fileUrl).to.equal(`http://${attributes.account.host}/static/webseed/${videoDetails.uuid}-${file.resolution.id}${extension}`) expect(file.resolution.id).to.equal(attributeFile.resolution) expect(file.resolution.label).to.equal(attributeFile.resolution + 'p') -- cgit v1.2.3