From 066e94c5382a761180c7d82fa24b31b66dbeaca4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Mar 2018 10:24:28 +0100 Subject: Add "local" videos in menu --- server/tests/api/videos/multiple-servers.ts | 32 ++++++++++++++++++++++++++++- server/tests/utils/videos/videos.ts | 12 +++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'server/tests') diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 3f6b82c50..42a1241f7 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -15,7 +15,7 @@ import { dateIsValid, doubleFollow, flushAndRunMultipleServers, - flushTests, + flushTests, getLocalVideos, getVideo, getVideoChannelsList, getVideosList, @@ -349,6 +349,36 @@ describe('Test multiple servers', function () { }) }) + describe('It should list local videos', function () { + it('Should list only local videos on server 1', async function () { + const { body } = await getLocalVideos(servers[0].url) + + expect(body.total).to.equal(1) + expect(body.data).to.be.an('array') + expect(body.data.length).to.equal(1) + expect(body.data[0].name).to.equal('my super name for server 1') + }) + + it('Should list only local videos on server 2', async function () { + const { body } = await getLocalVideos(servers[1].url) + + expect(body.total).to.equal(1) + expect(body.data).to.be.an('array') + expect(body.data.length).to.equal(1) + expect(body.data[0].name).to.equal('my super name for server 2') + }) + + it('Should list only local videos on server 3', async function () { + const { body } = await getLocalVideos(servers[2].url) + + expect(body.total).to.equal(2) + expect(body.data).to.be.an('array') + expect(body.data.length).to.equal(2) + expect(body.data[0].name).to.equal('my super name for server 3') + expect(body.data[1].name).to.equal('my super name for server 3-2') + }) + }) + describe('Should seed the uploaded video', function () { it('Should add the file 1 by asking server 3', async function () { this.timeout(10000) diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index ec40c5465..89db16fec 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -123,6 +123,17 @@ function getVideosList (url: string) { .expect('Content-Type', /json/) } +function getLocalVideos (url: string) { + const path = '/api/v1/videos' + + return request(url) + .get(path) + .query({ sort: 'name', filter: 'local' }) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) +} + function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string) { const path = '/api/v1/users/me/videos' @@ -487,6 +498,7 @@ export { rateVideo, viewVideo, parseTorrentVideo, + getLocalVideos, completeVideoCheck, checkVideoFilesWereRemoved } -- cgit v1.2.3