aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-28 16:40:21 +0200
committerChocobozzz <me@florianbigard.com>2021-07-28 16:40:21 +0200
commitfbd67e7f386504e50f2504cb6386700a58906f16 (patch)
tree1a7143aaea76ce4e195fb9d6214a0cd769c556ea /server/tests/api/search/search-videos.ts
parent164c8d46cf5c948a28b4ac0e596fad9b83b2c229 (diff)
downloadPeerTube-fbd67e7f386504e50f2504cb6386700a58906f16.tar.gz
PeerTube-fbd67e7f386504e50f2504cb6386700a58906f16.tar.zst
PeerTube-fbd67e7f386504e50f2504cb6386700a58906f16.zip
Add ability to search by uuids/actor names
Diffstat (limited to 'server/tests/api/search/search-videos.ts')
-rw-r--r--server/tests/api/search/search-videos.ts28
1 files changed, 25 insertions, 3 deletions
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index a56dc1d87..bd1e4d266 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -22,14 +22,19 @@ describe('Test videos search', function () {
22 let remoteServer: PeerTubeServer 22 let remoteServer: PeerTubeServer
23 let startDate: string 23 let startDate: string
24 let videoUUID: string 24 let videoUUID: string
25 let videoShortUUID: string
25 26
26 let command: SearchCommand 27 let command: SearchCommand
27 28
28 before(async function () { 29 before(async function () {
29 this.timeout(120000) 30 this.timeout(120000)
30 31
31 server = await createSingleServer(1) 32 const servers = await Promise.all([
32 remoteServer = await createSingleServer(2) 33 createSingleServer(1),
34 createSingleServer(2)
35 ])
36 server = servers[0]
37 remoteServer = servers[1]
33 38
34 await setAccessTokensToServers([ server, remoteServer ]) 39 await setAccessTokensToServers([ server, remoteServer ])
35 await setDefaultVideoChannel([ server, remoteServer ]) 40 await setDefaultVideoChannel([ server, remoteServer ])
@@ -50,8 +55,9 @@ describe('Test videos search', function () {
50 55
51 { 56 {
52 const attributes3 = { ...attributes1, name: attributes1.name + ' - 3', language: undefined } 57 const attributes3 = { ...attributes1, name: attributes1.name + ' - 3', language: undefined }
53 const { id, uuid } = await server.videos.upload({ attributes: attributes3 }) 58 const { id, uuid, shortUUID } = await server.videos.upload({ attributes: attributes3 })
54 videoUUID = uuid 59 videoUUID = uuid
60 videoShortUUID = shortUUID
55 61
56 await server.captions.add({ 62 await server.captions.add({
57 language: 'en', 63 language: 'en',
@@ -479,6 +485,22 @@ describe('Test videos search', function () {
479 expect(body.data[0].name).to.equal('1111 2222 3333 - 3') 485 expect(body.data[0].name).to.equal('1111 2222 3333 - 3')
480 }) 486 })
481 487
488 it('Should filter by UUIDs', async function () {
489 for (const uuid of [ videoUUID, videoShortUUID ]) {
490 const body = await command.advancedVideoSearch({ search: { uuids: [ uuid ] } })
491
492 expect(body.total).to.equal(1)
493 expect(body.data[0].name).to.equal('1111 2222 3333 - 3')
494 }
495
496 {
497 const body = await command.advancedVideoSearch({ search: { uuids: [ 'dfd70b83-639f-4980-94af-304a56ab4b35' ] } })
498
499 expect(body.total).to.equal(0)
500 expect(body.data).to.have.lengthOf(0)
501 }
502 })
503
482 it('Should search by host', async function () { 504 it('Should search by host', async function () {
483 { 505 {
484 const body = await command.advancedVideoSearch({ search: { search: '6666 7777 8888', host: server.host } }) 506 const body = await command.advancedVideoSearch({ search: { search: '6666 7777 8888', host: server.host } })