From b1fa3eba70dbd7d9e5b795ad251e293c88ebeee2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 6 Dec 2017 17:15:59 +0100 Subject: Begin video watch design --- server/models/video/video.ts | 3 ++- server/tests/api/follows.ts | 2 +- server/tests/api/multiple-servers.ts | 11 ++++++----- server/tests/api/services.ts | 4 ++-- server/tests/api/single-server.ts | 15 ++++++++------- server/tests/api/users.ts | 4 ++-- server/tests/utils/servers.ts | 2 +- 7 files changed, 22 insertions(+), 19 deletions(-) (limited to 'server') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 4dce8e2fc..60023bc8c 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -486,7 +486,7 @@ toFormattedJSON = function (this: VideoInstance) { description: this.getTruncatedDescription(), serverHost, isLocal: this.isOwned(), - account: this.VideoChannel.Account.name, + accountName: this.VideoChannel.Account.name, duration: this.duration, views: this.views, likes: this.likes, @@ -514,6 +514,7 @@ toFormattedDetailsJSON = function (this: VideoInstance) { privacy: this.privacy, descriptionPath: this.getDescriptionPath(), channel: this.VideoChannel.toFormattedJSON(), + account: this.VideoChannel.Account.toFormattedJSON(), files: [] } diff --git a/server/tests/api/follows.ts b/server/tests/api/follows.ts index aadae3cce..dcb4c8bd9 100644 --- a/server/tests/api/follows.ts +++ b/server/tests/api/follows.ts @@ -227,7 +227,7 @@ describe('Test follows', function () { expect(videoDetails.nsfw).to.be.ok expect(videoDetails.description).to.equal('my super description') expect(videoDetails.serverHost).to.equal('localhost:9003') - expect(videoDetails.account).to.equal('root') + expect(videoDetails.accountName).to.equal('root') expect(videoDetails.likes).to.equal(1) expect(videoDetails.dislikes).to.equal(1) expect(videoDetails.isLocal).to.be.false diff --git a/server/tests/api/multiple-servers.ts b/server/tests/api/multiple-servers.ts index c80ded862..c7f19f261 100644 --- a/server/tests/api/multiple-servers.ts +++ b/server/tests/api/multiple-servers.ts @@ -111,13 +111,14 @@ describe('Test multiple servers', function () { expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ]) expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true - expect(video.account).to.equal('root') + expect(video.accountName).to.equal('root') const res2 = await getVideo(server.url, video.uuid) const videoDetails = res2.body expect(videoDetails.channel.name).to.equal('my channel') expect(videoDetails.channel.description).to.equal('super channel') + expect(videoDetails.account.name).to.equal('root') expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true expect(videoDetails.files).to.have.lengthOf(1) @@ -201,7 +202,7 @@ describe('Test multiple servers', function () { expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true - expect(video.account).to.equal('user1') + expect(video.accountName).to.equal('user1') if (server.url !== 'http://localhost:9002') { expect(video.isLocal).to.be.false @@ -316,7 +317,7 @@ describe('Test multiple servers', function () { expect(video1.serverHost).to.equal('localhost:9003') expect(video1.duration).to.equal(5) expect(video1.tags).to.deep.equal([ 'tag1p3' ]) - expect(video1.account).to.equal('root') + expect(video1.accountName).to.equal('root') expect(dateIsValid(video1.createdAt)).to.be.true expect(dateIsValid(video1.updatedAt)).to.be.true @@ -342,7 +343,7 @@ describe('Test multiple servers', function () { expect(video2.serverHost).to.equal('localhost:9003') expect(video2.duration).to.equal(5) expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ]) - expect(video2.account).to.equal('root') + expect(video2.accountName).to.equal('root') expect(dateIsValid(video2.createdAt)).to.be.true expect(dateIsValid(video2.updatedAt)).to.be.true @@ -690,7 +691,7 @@ 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.account).to.equal(video.account) + expect(baseVideo.accountName).to.equal(video.accountName) expect(baseVideo.tags).to.deep.equal(video.tags) } }) diff --git a/server/tests/api/services.ts b/server/tests/api/services.ts index 8d96ccc5e..4d480c305 100644 --- a/server/tests/api/services.ts +++ b/server/tests/api/services.ts @@ -46,7 +46,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.account) + expect(res.body.author_name).to.equal(server.video.accountName) expect(res.body.width).to.equal(560) expect(res.body.height).to.equal(315) expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl) @@ -66,7 +66,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.account) + expect(res.body.author_name).to.equal(server.video.accountName) 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/single-server.ts b/server/tests/api/single-server.ts index fe192d391..d7e9ad41f 100644 --- a/server/tests/api/single-server.ts +++ b/server/tests/api/single-server.ts @@ -127,7 +127,7 @@ describe('Test a single server', function () { expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.serverHost).to.equal('localhost:9001') - expect(video.account).to.equal('root') + expect(video.accountName).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 @@ -176,7 +176,7 @@ describe('Test a single server', function () { expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.serverHost).to.equal('localhost:9001') - expect(video.account).to.equal('root') + expect(video.accountName).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 @@ -243,7 +243,7 @@ describe('Test a single server', function () { expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description') expect(video.serverHost).to.equal('localhost:9001') - expect(video.account).to.equal('root') + expect(video.accountName).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 @@ -298,7 +298,7 @@ describe('Test a single server', function () { // expect(video.nsfw).to.be.ok // expect(video.description).to.equal('my super description') // expect(video.serverHost).to.equal('localhost:9001') - // expect(video.account).to.equal('root') + // expect(video.accountName).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 @@ -563,7 +563,8 @@ describe('Test a single server', function () { expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description updated') expect(video.serverHost).to.equal('localhost:9001') - expect(video.account).to.equal('root') + expect(video.accountName).to.equal('root') + expect(video.account.name).to.equal('root') expect(video.isLocal).to.be.true expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) expect(dateIsValid(video.createdAt)).to.be.true @@ -612,7 +613,7 @@ describe('Test a single server', function () { expect(video.nsfw).to.be.ok expect(video.description).to.equal('my super description updated') expect(video.serverHost).to.equal('localhost:9001') - expect(video.account).to.equal('root') + expect(video.accountName).to.equal('root') expect(video.isLocal).to.be.true expect(video.tags).to.deep.equal([ 'supertag', 'tag1', 'tag2' ]) expect(dateIsValid(video.createdAt)).to.be.true @@ -652,7 +653,7 @@ describe('Test a single server', function () { expect(video.nsfw).to.be.ok expect(video.description).to.equal('hello everybody') expect(video.serverHost).to.equal('localhost:9001') - expect(video.account).to.equal('root') + expect(video.accountName).to.equal('root') expect(video.isLocal).to.be.true expect(video.tags).to.deep.equal([ 'supertag', 'tag1', 'tag2' ]) expect(dateIsValid(video.createdAt)).to.be.true diff --git a/server/tests/api/users.ts b/server/tests/api/users.ts index 33646e84f..5066e73fc 100644 --- a/server/tests/api/users.ts +++ b/server/tests/api/users.ts @@ -117,7 +117,7 @@ describe('Test users', function () { const res = await getVideosList(server.url) const video = res.body.data[ 0 ] - expect(video.account) + expect(video.accountName) .to .equal('root') videoId = video.id @@ -487,7 +487,7 @@ describe('Test users', function () { .equal(1) const video = res.body.data[ 0 ] - expect(video.account) + expect(video.accountName) .to .equal('root') }) diff --git a/server/tests/utils/servers.ts b/server/tests/utils/servers.ts index faa2f19ff..8340fbc18 100644 --- a/server/tests/utils/servers.ts +++ b/server/tests/utils/servers.ts @@ -24,7 +24,7 @@ interface ServerInfo { id: number uuid: string name: string - account: string + accountName: string } remoteVideo?: { -- cgit v1.2.3