aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts39
-rw-r--r--server/tests/api/search/search-activitypub-video-playlists.ts39
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts34
3 files changed, 84 insertions, 28 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)
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts
index 33ca7be12..34b318268 100644
--- a/server/tests/api/search/search-activitypub-video-playlists.ts
+++ b/server/tests/api/search/search-activitypub-video-playlists.ts
@@ -71,7 +71,7 @@ describe('Test ActivityPub playlists search', function () {
71 71
72 it('Should not find a remote playlist', async function () { 72 it('Should not find a remote playlist', async function () {
73 { 73 {
74 const search = 'http://localhost:' + servers[1].port + '/video-playlists/43' 74 const search = servers[1].url + '/video-playlists/43'
75 const body = await command.searchPlaylists({ search, token: servers[0].accessToken }) 75 const body = await command.searchPlaylists({ search, token: servers[0].accessToken })
76 76
77 expect(body.total).to.equal(0) 77 expect(body.total).to.equal(0)
@@ -81,7 +81,7 @@ describe('Test ActivityPub playlists search', function () {
81 81
82 { 82 {
83 // Without token 83 // Without token
84 const search = 'http://localhost:' + servers[1].port + '/video-playlists/' + playlistServer2UUID 84 const search = servers[1].url + '/video-playlists/' + playlistServer2UUID
85 const body = await command.searchPlaylists({ search }) 85 const body = await command.searchPlaylists({ search })
86 86
87 expect(body.total).to.equal(0) 87 expect(body.total).to.equal(0)
@@ -91,7 +91,7 @@ describe('Test ActivityPub playlists search', function () {
91 }) 91 })
92 92
93 it('Should search a local playlist', async function () { 93 it('Should search a local playlist', async function () {
94 const search = 'http://localhost:' + servers[0].port + '/video-playlists/' + playlistServer1UUID 94 const search = servers[0].url + '/video-playlists/' + playlistServer1UUID
95 const body = await command.searchPlaylists({ search }) 95 const body = await command.searchPlaylists({ search })
96 96
97 expect(body.total).to.equal(1) 97 expect(body.total).to.equal(1)
@@ -103,8 +103,8 @@ describe('Test ActivityPub playlists search', function () {
103 103
104 it('Should search a local playlist with an alternative URL', async function () { 104 it('Should search a local playlist with an alternative URL', async function () {
105 const searches = [ 105 const searches = [
106 'http://localhost:' + servers[0].port + '/videos/watch/playlist/' + playlistServer1UUID, 106 servers[0].url + '/videos/watch/playlist/' + playlistServer1UUID,
107 'http://localhost:' + servers[0].port + '/w/p/' + playlistServer1UUID 107 servers[0].url + '/w/p/' + playlistServer1UUID
108 ] 108 ]
109 109
110 for (const search of searches) { 110 for (const search of searches) {
@@ -120,11 +120,30 @@ describe('Test ActivityPub playlists search', function () {
120 } 120 }
121 }) 121 })
122 122
123 it('Should search a local playlist with a query in URL', async function () {
124 const searches = [
125 servers[0].url + '/videos/watch/playlist/' + playlistServer1UUID,
126 servers[0].url + '/w/p/' + playlistServer1UUID
127 ]
128
129 for (const search of searches) {
130 for (const token of [ undefined, servers[0].accessToken ]) {
131 const body = await command.searchPlaylists({ search: search + '?param=1', token })
132
133 expect(body.total).to.equal(1)
134 expect(body.data).to.be.an('array')
135 expect(body.data).to.have.lengthOf(1)
136 expect(body.data[0].displayName).to.equal('playlist 1 on server 1')
137 expect(body.data[0].videosLength).to.equal(2)
138 }
139 }
140 })
141
123 it('Should search a remote playlist', async function () { 142 it('Should search a remote playlist', async function () {
124 const searches = [ 143 const searches = [
125 'http://localhost:' + servers[1].port + '/video-playlists/' + playlistServer2UUID, 144 servers[1].url + '/video-playlists/' + playlistServer2UUID,
126 'http://localhost:' + servers[1].port + '/videos/watch/playlist/' + playlistServer2UUID, 145 servers[1].url + '/videos/watch/playlist/' + playlistServer2UUID,
127 'http://localhost:' + servers[1].port + '/w/p/' + playlistServer2UUID 146 servers[1].url + '/w/p/' + playlistServer2UUID
128 ] 147 ]
129 148
130 for (const search of searches) { 149 for (const search of searches) {
@@ -155,7 +174,7 @@ describe('Test ActivityPub playlists search', function () {
155 await wait(10000) 174 await wait(10000)
156 175
157 // Will run refresh async 176 // Will run refresh async
158 const search = 'http://localhost:' + servers[1].port + '/video-playlists/' + playlistServer2UUID 177 const search = servers[1].url + '/video-playlists/' + playlistServer2UUID
159 await command.searchPlaylists({ search, token: servers[0].accessToken }) 178 await command.searchPlaylists({ search, token: servers[0].accessToken })
160 179
161 // Wait refresh 180 // Wait refresh
@@ -179,7 +198,7 @@ describe('Test ActivityPub playlists search', function () {
179 await wait(10000) 198 await wait(10000)
180 199
181 // Will run refresh async 200 // Will run refresh async
182 const search = 'http://localhost:' + servers[1].port + '/video-playlists/' + playlistServer2UUID 201 const search = servers[1].url + '/video-playlists/' + playlistServer2UUID
183 await command.searchPlaylists({ search, token: servers[0].accessToken }) 202 await command.searchPlaylists({ search, token: servers[0].accessToken })
184 203
185 // Wait refresh 204 // Wait refresh
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index b3cfcacca..a2e6e70fe 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -46,7 +46,7 @@ describe('Test ActivityPub videos search', function () {
46 46
47 it('Should not find a remote video', async function () { 47 it('Should not find a remote video', async function () {
48 { 48 {
49 const search = 'http://localhost:' + servers[1].port + '/videos/watch/43' 49 const search = servers[1].url + '/videos/watch/43'
50 const body = await command.searchVideos({ search, token: servers[0].accessToken }) 50 const body = await command.searchVideos({ search, token: servers[0].accessToken })
51 51
52 expect(body.total).to.equal(0) 52 expect(body.total).to.equal(0)
@@ -56,7 +56,7 @@ describe('Test ActivityPub videos search', function () {
56 56
57 { 57 {
58 // Without token 58 // Without token
59 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID 59 const search = servers[1].url + '/videos/watch/' + videoServer2UUID
60 const body = await command.searchVideos({ search }) 60 const body = await command.searchVideos({ search })
61 61
62 expect(body.total).to.equal(0) 62 expect(body.total).to.equal(0)
@@ -66,7 +66,7 @@ describe('Test ActivityPub videos search', function () {
66 }) 66 })
67 67
68 it('Should search a local video', async function () { 68 it('Should search a local video', async function () {
69 const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID 69 const search = servers[0].url + '/videos/watch/' + videoServer1UUID
70 const body = await command.searchVideos({ search }) 70 const body = await command.searchVideos({ search })
71 71
72 expect(body.total).to.equal(1) 72 expect(body.total).to.equal(1)
@@ -76,7 +76,7 @@ describe('Test ActivityPub videos search', function () {
76 }) 76 })
77 77
78 it('Should search a local video with an alternative URL', async function () { 78 it('Should search a local video with an alternative URL', async function () {
79 const search = 'http://localhost:' + servers[0].port + '/w/' + videoServer1UUID 79 const search = servers[0].url + '/w/' + videoServer1UUID
80 const body1 = await command.searchVideos({ search }) 80 const body1 = await command.searchVideos({ search })
81 const body2 = await command.searchVideos({ search, token: servers[0].accessToken }) 81 const body2 = await command.searchVideos({ search, token: servers[0].accessToken })
82 82
@@ -88,10 +88,28 @@ describe('Test ActivityPub videos search', function () {
88 } 88 }
89 }) 89 })
90 90
91 it('Should search a local video with a query in URL', async function () {
92 const searches = [
93 servers[0].url + '/w/' + videoServer1UUID,
94 servers[0].url + '/videos/watch/' + videoServer1UUID
95 ]
96
97 for (const search of searches) {
98 for (const token of [ undefined, servers[0].accessToken ]) {
99 const body = await command.searchVideos({ search: search + '?startTime=4', token })
100
101 expect(body.total).to.equal(1)
102 expect(body.data).to.be.an('array')
103 expect(body.data).to.have.lengthOf(1)
104 expect(body.data[0].name).to.equal('video 1 on server 1')
105 }
106 }
107 })
108
91 it('Should search a remote video', async function () { 109 it('Should search a remote video', async function () {
92 const searches = [ 110 const searches = [
93 'http://localhost:' + servers[1].port + '/w/' + videoServer2UUID, 111 servers[1].url + '/w/' + videoServer2UUID,
94 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID 112 servers[1].url + '/videos/watch/' + videoServer2UUID
95 ] 113 ]
96 114
97 for (const search of searches) { 115 for (const search of searches) {
@@ -134,7 +152,7 @@ describe('Test ActivityPub videos search', function () {
134 await wait(10000) 152 await wait(10000)
135 153
136 // Will run refresh async 154 // Will run refresh async
137 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID 155 const search = servers[1].url + '/videos/watch/' + videoServer2UUID
138 await command.searchVideos({ search, token: servers[0].accessToken }) 156 await command.searchVideos({ search, token: servers[0].accessToken })
139 157
140 // Wait refresh 158 // Wait refresh
@@ -160,7 +178,7 @@ describe('Test ActivityPub videos search', function () {
160 await wait(10000) 178 await wait(10000)
161 179
162 // Will run refresh async 180 // Will run refresh async
163 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID 181 const search = servers[1].url + '/videos/watch/' + videoServer2UUID
164 await command.searchVideos({ search, token: servers[0].accessToken }) 182 await command.searchVideos({ search, token: servers[0].accessToken })
165 183
166 // Wait refresh 184 // Wait refresh