From 370240824e2fb28b314255f6c23f5ea7d6b08625 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 19 Jan 2021 13:43:33 +0100 Subject: Allow users/visitors to search through an account's videos (#3589) * WIP: account search * add search to account view * add tests for account search --- server/tests/api/users/users-multiple-servers.ts | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'server/tests/api/users') diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 591ce4959..dcd03879b 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -34,7 +34,7 @@ describe('Test users with multiple servers', function () { let userAvatarFilename: string before(async function () { - this.timeout(120000) + this.timeout(120_000) servers = await flushAndRunMultipleServers(3) @@ -92,7 +92,7 @@ describe('Test users with multiple servers', function () { }) it('Should be able to update my description', async function () { - this.timeout(10000) + this.timeout(10_000) await updateMyUser({ url: servers[0].url, @@ -109,7 +109,7 @@ describe('Test users with multiple servers', function () { }) it('Should be able to update my avatar', async function () { - this.timeout(10000) + this.timeout(10_000) const fixture = 'avatar2.png' @@ -164,8 +164,27 @@ describe('Test users with multiple servers', function () { } }) + it('Should search through account videos', async function () { + this.timeout(10_000) + + const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'Kami no chikara' }) + + await waitJobs(servers) + + for (const server of servers) { + const res = await getAccountVideos(server.url, server.accessToken, 'user1@localhost:' + servers[0].port, 0, 5, undefined, { + search: 'Kami' + }) + + expect(res.body.total).to.equal(1) + expect(res.body.data).to.be.an('array') + expect(res.body.data).to.have.lengthOf(1) + expect(res.body.data[0].uuid).to.equal(resVideo.body.video.uuid) + } + }) + it('Should remove the user', async function () { - this.timeout(10000) + this.timeout(10_000) for (const server of servers) { const resAccounts = await getAccountsList(server.url, '-createdAt') -- cgit v1.2.3