aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-activitypub-video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-20 15:01:17 +0200
committerChocobozzz <me@florianbigard.com>2021-10-20 15:26:38 +0200
commit400043b1be38cdd7bc39462fa6a545eea0bea03e (patch)
tree68f447d00e06f80bbe84bf38dac30005e66cf2e4 /server/tests/api/search/search-activitypub-video-channels.ts
parentebe9b6b3f32d8432980854a51d28a8fb88fe62e5 (diff)
downloadPeerTube-400043b1be38cdd7bc39462fa6a545eea0bea03e.tar.gz
PeerTube-400043b1be38cdd7bc39462fa6a545eea0bea03e.tar.zst
PeerTube-400043b1be38cdd7bc39462fa6a545eea0bea03e.zip
Add ability to search by URL with query params
Diffstat (limited to 'server/tests/api/search/search-activitypub-video-channels.ts')
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts39
1 files changed, 29 insertions, 10 deletions
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index 426cbc8e1..efcdb33dc 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -64,7 +64,7 @@ describe('Test ActivityPub video channels search', function () {
64 this.timeout(15000) 64 this.timeout(15000)
65 65
66 { 66 {
67 const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server3' 67 const search = servers[1].url + '/video-channels/channel1_server3'
68 const body = await command.searchChannels({ search, token: servers[0].accessToken }) 68 const body = await command.searchChannels({ search, token: servers[0].accessToken })
69 69
70 expect(body.total).to.equal(0) 70 expect(body.total).to.equal(0)
@@ -74,7 +74,7 @@ describe('Test ActivityPub video channels search', function () {
74 74
75 { 75 {
76 // Without token 76 // Without token
77 const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' 77 const search = servers[1].url + '/video-channels/channel1_server2'
78 const body = await command.searchChannels({ search }) 78 const body = await command.searchChannels({ search })
79 79
80 expect(body.total).to.equal(0) 80 expect(body.total).to.equal(0)
@@ -85,7 +85,7 @@ describe('Test ActivityPub video channels search', function () {
85 85
86 it('Should search a local video channel', async function () { 86 it('Should search a local video channel', async function () {
87 const searches = [ 87 const searches = [
88 'http://localhost:' + servers[0].port + '/video-channels/channel1_server1', 88 servers[0].url + '/video-channels/channel1_server1',
89 'channel1_server1@localhost:' + servers[0].port 89 'channel1_server1@localhost:' + servers[0].port
90 ] 90 ]
91 91
@@ -101,7 +101,7 @@ describe('Test ActivityPub video channels search', function () {
101 }) 101 })
102 102
103 it('Should search a local video channel with an alternative URL', async function () { 103 it('Should search a local video channel with an alternative URL', async function () {
104 const search = 'http://localhost:' + servers[0].port + '/c/channel1_server1' 104 const search = servers[0].url + '/c/channel1_server1'
105 105
106 for (const token of [ undefined, servers[0].accessToken ]) { 106 for (const token of [ undefined, servers[0].accessToken ]) {
107 const body = await command.searchChannels({ search, token }) 107 const body = await command.searchChannels({ search, token })
@@ -114,11 +114,30 @@ describe('Test ActivityPub video channels search', function () {
114 } 114 }
115 }) 115 })
116 116
117 it('Should search a local video channel with a query in URL', async function () {
118 const searches = [
119 servers[0].url + '/video-channels/channel1_server1',
120 servers[0].url + '/c/channel1_server1'
121 ]
122
123 for (const search of searches) {
124 for (const token of [ undefined, servers[0].accessToken ]) {
125 const body = await command.searchChannels({ search: search + '?param=2', token })
126
127 expect(body.total).to.equal(1)
128 expect(body.data).to.be.an('array')
129 expect(body.data).to.have.lengthOf(1)
130 expect(body.data[0].name).to.equal('channel1_server1')
131 expect(body.data[0].displayName).to.equal('Channel 1 server 1')
132 }
133 }
134 })
135
117 it('Should search a remote video channel with URL or handle', async function () { 136 it('Should search a remote video channel with URL or handle', async function () {
118 const searches = [ 137 const searches = [
119 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2', 138 servers[1].url + '/video-channels/channel1_server2',
120 'http://localhost:' + servers[1].port + '/c/channel1_server2', 139 servers[1].url + '/c/channel1_server2',
121 'http://localhost:' + servers[1].port + '/c/channel1_server2/videos', 140 servers[1].url + '/c/channel1_server2/videos',
122 'channel1_server2@localhost:' + servers[1].port 141 'channel1_server2@localhost:' + servers[1].port
123 ] 142 ]
124 143
@@ -178,7 +197,7 @@ describe('Test ActivityPub video channels search', function () {
178 // Expire video channel 197 // Expire video channel
179 await wait(10000) 198 await wait(10000)
180 199
181 const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' 200 const search = servers[1].url + '/video-channels/channel1_server2'
182 const body = await command.searchChannels({ search, token: servers[0].accessToken }) 201 const body = await command.searchChannels({ search, token: servers[0].accessToken })
183 expect(body.total).to.equal(1) 202 expect(body.total).to.equal(1)
184 expect(body.data).to.have.lengthOf(1) 203 expect(body.data).to.have.lengthOf(1)
@@ -201,7 +220,7 @@ describe('Test ActivityPub video channels search', function () {
201 // Expire video channel 220 // Expire video channel
202 await wait(10000) 221 await wait(10000)
203 222
204 const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' 223 const search = servers[1].url + '/video-channels/channel1_server2'
205 await command.searchChannels({ search, token: servers[0].accessToken }) 224 await command.searchChannels({ search, token: servers[0].accessToken })
206 225
207 await waitJobs(servers) 226 await waitJobs(servers)
@@ -223,7 +242,7 @@ describe('Test ActivityPub video channels search', function () {
223 // Expire video 242 // Expire video
224 await wait(10000) 243 await wait(10000)
225 244
226 const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' 245 const search = servers[1].url + '/video-channels/channel1_server2'
227 const body = await command.searchChannels({ search, token: servers[0].accessToken }) 246 const body = await command.searchChannels({ search, token: servers[0].accessToken })
228 expect(body.total).to.equal(0) 247 expect(body.total).to.equal(0)
229 expect(body.data).to.have.lengthOf(0) 248 expect(body.data).to.have.lengthOf(0)