From b64c950a1cb37da880fc14e8535f438c78b5b7f7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Mar 2018 11:06:15 +0100 Subject: Update videos api list for account --- server/tests/api/videos/multiple-servers.ts | 73 ++++++++++++++++++++++------- server/tests/api/videos/services.ts | 4 +- server/tests/api/videos/single-server.ts | 42 ++++------------- 3 files changed, 67 insertions(+), 52 deletions(-) (limited to 'server/tests/api/videos') diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 27c4c30b8..3f6b82c50 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -8,13 +8,35 @@ import { VideoPrivacy } from '../../../../shared/models/videos' import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' import { - addVideoChannel, checkVideoFilesWereRemoved, completeVideoCheck, createUser, dateIsValid, doubleFollow, flushAndRunMultipleServers, - flushTests, getVideo, - getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testImage, - updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd + addVideoChannel, + checkVideoFilesWereRemoved, + completeVideoCheck, + createUser, + dateIsValid, + doubleFollow, + flushAndRunMultipleServers, + flushTests, + getVideo, + getVideoChannelsList, + getVideosList, + killallServers, + rateVideo, + removeVideo, + ServerInfo, + setAccessTokensToServers, + testImage, + updateVideo, + uploadVideo, + userLogin, + viewVideo, + wait, + webtorrentAdd } from '../../utils' import { - addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads, + addVideoCommentReply, + addVideoCommentThread, + deleteVideoComment, + getVideoCommentThreads, getVideoThreadComments } from '../../utils/videos/video-comments' @@ -90,8 +112,10 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description for server 1', support: 'my super support text for server 1', - host: 'localhost:9001', - account: 'root', + account: { + name: 'root', + host: 'localhost:9001' + }, isLocal, duration: 10, tags: [ 'tag1p1', 'tag2p1' ], @@ -160,8 +184,10 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description for server 2', support: 'my super support text for server 2', - host: 'localhost:9002', - account: 'user1', + account: { + name: 'user1', + host: 'localhost:9002' + }, isLocal, commentsEnabled: true, duration: 5, @@ -264,8 +290,10 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description for server 3', support: 'my super support text for server 3', - host: 'localhost:9003', - account: 'root', + account: { + name: 'root', + host: 'localhost:9003' + }, isLocal, duration: 5, commentsEnabled: true, @@ -294,8 +322,10 @@ describe('Test multiple servers', function () { nsfw: false, description: 'my super description for server 3-2', support: 'my super support text for server 3-2', - host: 'localhost:9003', - account: 'root', + account: { + name: 'root', + host: 'localhost:9003' + }, commentsEnabled: true, isLocal, duration: 5, @@ -570,8 +600,10 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description updated', support: 'my super support text updated', - host: 'localhost:9003', - account: 'root', + account: { + name: 'root', + host: 'localhost:9003' + }, isLocal, duration: 5, commentsEnabled: true, @@ -648,7 +680,10 @@ describe('Test multiple servers', function () { expect(baseVideo.licence).to.equal(video.licence) expect(baseVideo.category).to.equal(video.category) expect(baseVideo.nsfw).to.equal(video.nsfw) - expect(baseVideo.accountName).to.equal(video.accountName) + expect(baseVideo.account.name).to.equal(video.account.name) + expect(baseVideo.account.displayName).to.equal(video.account.displayName) + expect(baseVideo.account.url).to.equal(video.account.url) + expect(baseVideo.account.host).to.equal(video.account.host) expect(baseVideo.tags).to.deep.equal(video.tags) } }) @@ -859,8 +894,10 @@ describe('Test multiple servers', function () { nsfw: false, description: null, support: null, - host: 'localhost:9002', - account: 'root', + account: { + name: 'root', + host: 'localhost:9002' + }, isLocal, duration: 5, commentsEnabled: true, diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts index e456184cf..45b4a1a81 100644 --- a/server/tests/api/videos/services.ts +++ b/server/tests/api/videos/services.ts @@ -38,7 +38,7 @@ describe('Test services', function () { expect(res.body.html).to.equal(expectedHtml) expect(res.body.title).to.equal(server.video.name) - expect(res.body.author_name).to.equal(server.video.accountName) + expect(res.body.author_name).to.equal(server.video.account.name) expect(res.body.width).to.equal(560) expect(res.body.height).to.equal(315) expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl) @@ -58,7 +58,7 @@ describe('Test services', function () { expect(res.body.html).to.equal(expectedHtml) expect(res.body.title).to.equal(server.video.name) - expect(res.body.author_name).to.equal(server.video.accountName) + expect(res.body.author_name).to.equal(server.video.account.name) expect(res.body.height).to.equal(50) expect(res.body.width).to.equal(50) expect(res.body).to.not.have.property('thumbnail_url') diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index cf2721838..7c4bdf8bc 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -27,8 +27,10 @@ describe('Test a single server', function () { nsfw: true, description: 'my super description', support: 'my super support text', - host: 'localhost:9001', - account: 'root', + account: { + name: 'root', + host: 'localhost:9001' + }, isLocal: true, duration: 5, tags: [ 'tag1', 'tag2', 'tag3' ], @@ -56,8 +58,10 @@ describe('Test a single server', function () { nsfw: false, description: 'my super description updated', support: 'my super support text updated', - host: 'localhost:9001', - account: 'root', + account: { + name: 'root', + host: 'localhost:9001' + }, isLocal: true, tags: [ 'tagup1', 'tagup2' ], privacy: VideoPrivacy.PUBLIC, @@ -204,32 +208,6 @@ describe('Test a single server', function () { await completeVideoCheck(server.url, video, getCheckAttributes) }) - // Not implemented yet - // it('Should search the video by serverHost', async function () { - // const res = await videosUtils.searchVideo(server.url, '9001', 'host') - - // expect(res.body.total).to.equal(1) - // expect(res.body.data).to.be.an('array') - // expect(res.body.data.length).to.equal(1) - - // const video = res.body.data[0] - // expect(video.name).to.equal('my super name') - // expect(video.description).to.equal('my super description') - // expect(video.serverHost).to.equal('localhost:9001') - // expect(video.author).to.equal('root') - // expect(video.isLocal).to.be.true - // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) - // expect(dateIsValid(video.createdAt)).to.be.true - // expect(dateIsValid(video.updatedAt)).to.be.true - - // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) - // expect(test).to.equal(true) - - // done() - // }) - // }) - // }) - // Not implemented yet // it('Should search the video by tag', async function () { // const res = await searchVideo(server.url, 'tag1') @@ -248,8 +226,8 @@ describe('Test a single server', function () { // expect(video.languageLabel).to.equal('Mandarin') // expect(video.nsfw).to.be.ok // expect(video.description).to.equal('my super description') - // expect(video.serverHost).to.equal('localhost:9001') - // expect(video.accountName).to.equal('root') + // expect(video.account.name).to.equal('root') + // expect(video.account.host).to.equal('localhost:9001') // expect(video.isLocal).to.be.true // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) // expect(dateIsValid(video.createdAt)).to.be.true -- cgit v1.2.3