diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-31 16:56:52 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-03 08:31:02 +0100 |
commit | a15871560f80e07386c1dabb8370cd2664ecfd1f (patch) | |
tree | 44440e140c9e43b0d7f97ade777a76e649e0553d /server/tests/api/search | |
parent | a22046d166805222ca76060e471b6cb3d419a32d (diff) | |
download | PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.tar.gz PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.tar.zst PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.zip |
Move to eslintcontain
Diffstat (limited to 'server/tests/api/search')
-rw-r--r-- | server/tests/api/search/search-activitypub-video-channels.ts | 44 | ||||
-rw-r--r-- | server/tests/api/search/search-activitypub-videos.ts | 8 | ||||
-rw-r--r-- | server/tests/api/search/search-videos.ts | 14 |
3 files changed, 33 insertions, 33 deletions
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index d5f0a5457..d7e3ed5be 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
@@ -39,7 +39,7 @@ describe('Test ActivityPub video channels search', function () { | |||
39 | await setAccessTokensToServers(servers) | 39 | await setAccessTokensToServers(servers) |
40 | 40 | ||
41 | { | 41 | { |
42 | await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: 'user1_server1', password: 'password' }) | 42 | await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: 'user1_server1', password: 'password' }) |
43 | const channel = { | 43 | const channel = { |
44 | name: 'channel1_server1', | 44 | name: 'channel1_server1', |
45 | displayName: 'Channel 1 server 1' | 45 | displayName: 'Channel 1 server 1' |
@@ -49,7 +49,7 @@ describe('Test ActivityPub video channels search', function () { | |||
49 | 49 | ||
50 | { | 50 | { |
51 | const user = { username: 'user1_server2', password: 'password' } | 51 | const user = { username: 'user1_server2', password: 'password' } |
52 | await createUser({ url: servers[ 1 ].url, accessToken: servers[ 1 ].accessToken, username: user.username, password: user.password }) | 52 | await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password }) |
53 | userServer2Token = await userLogin(servers[1], user) | 53 | userServer2Token = await userLogin(servers[1], user) |
54 | 54 | ||
55 | const channel = { | 55 | const channel = { |
@@ -70,8 +70,8 @@ describe('Test ActivityPub video channels search', function () { | |||
70 | this.timeout(15000) | 70 | this.timeout(15000) |
71 | 71 | ||
72 | { | 72 | { |
73 | const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server3' | 73 | const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server3' |
74 | const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken) | 74 | const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) |
75 | 75 | ||
76 | expect(res.body.total).to.equal(0) | 76 | expect(res.body.total).to.equal(0) |
77 | expect(res.body.data).to.be.an('array') | 77 | expect(res.body.data).to.be.an('array') |
@@ -80,7 +80,7 @@ describe('Test ActivityPub video channels search', function () { | |||
80 | 80 | ||
81 | { | 81 | { |
82 | // Without token | 82 | // Without token |
83 | const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' | 83 | const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' |
84 | const res = await searchVideoChannel(servers[0].url, search) | 84 | const res = await searchVideoChannel(servers[0].url, search) |
85 | 85 | ||
86 | expect(res.body.total).to.equal(0) | 86 | expect(res.body.total).to.equal(0) |
@@ -91,35 +91,35 @@ describe('Test ActivityPub video channels search', function () { | |||
91 | 91 | ||
92 | it('Should search a local video channel', async function () { | 92 | it('Should search a local video channel', async function () { |
93 | const searches = [ | 93 | const searches = [ |
94 | 'http://localhost:' + servers[ 0 ].port + '/video-channels/channel1_server1', | 94 | 'http://localhost:' + servers[0].port + '/video-channels/channel1_server1', |
95 | 'channel1_server1@localhost:' + servers[ 0 ].port | 95 | 'channel1_server1@localhost:' + servers[0].port |
96 | ] | 96 | ] |
97 | 97 | ||
98 | for (const search of searches) { | 98 | for (const search of searches) { |
99 | const res = await searchVideoChannel(servers[ 0 ].url, search) | 99 | const res = await searchVideoChannel(servers[0].url, search) |
100 | 100 | ||
101 | expect(res.body.total).to.equal(1) | 101 | expect(res.body.total).to.equal(1) |
102 | expect(res.body.data).to.be.an('array') | 102 | expect(res.body.data).to.be.an('array') |
103 | expect(res.body.data).to.have.lengthOf(1) | 103 | expect(res.body.data).to.have.lengthOf(1) |
104 | expect(res.body.data[ 0 ].name).to.equal('channel1_server1') | 104 | expect(res.body.data[0].name).to.equal('channel1_server1') |
105 | expect(res.body.data[ 0 ].displayName).to.equal('Channel 1 server 1') | 105 | expect(res.body.data[0].displayName).to.equal('Channel 1 server 1') |
106 | } | 106 | } |
107 | }) | 107 | }) |
108 | 108 | ||
109 | it('Should search a remote video channel with URL or handle', async function () { | 109 | it('Should search a remote video channel with URL or handle', async function () { |
110 | const searches = [ | 110 | const searches = [ |
111 | 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2', | 111 | 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2', |
112 | 'channel1_server2@localhost:' + servers[ 1 ].port | 112 | 'channel1_server2@localhost:' + servers[1].port |
113 | ] | 113 | ] |
114 | 114 | ||
115 | for (const search of searches) { | 115 | for (const search of searches) { |
116 | const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken) | 116 | const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) |
117 | 117 | ||
118 | expect(res.body.total).to.equal(1) | 118 | expect(res.body.total).to.equal(1) |
119 | expect(res.body.data).to.be.an('array') | 119 | expect(res.body.data).to.be.an('array') |
120 | expect(res.body.data).to.have.lengthOf(1) | 120 | expect(res.body.data).to.have.lengthOf(1) |
121 | expect(res.body.data[ 0 ].name).to.equal('channel1_server2') | 121 | expect(res.body.data[0].name).to.equal('channel1_server2') |
122 | expect(res.body.data[ 0 ].displayName).to.equal('Channel 1 server 2') | 122 | expect(res.body.data[0].displayName).to.equal('Channel 1 server 2') |
123 | } | 123 | } |
124 | }) | 124 | }) |
125 | 125 | ||
@@ -137,13 +137,13 @@ describe('Test ActivityPub video channels search', function () { | |||
137 | 137 | ||
138 | await waitJobs(servers) | 138 | await waitJobs(servers) |
139 | 139 | ||
140 | const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5) | 140 | const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[1].port, 0, 5) |
141 | expect(res.body.total).to.equal(0) | 141 | expect(res.body.total).to.equal(0) |
142 | expect(res.body.data).to.have.lengthOf(0) | 142 | expect(res.body.data).to.have.lengthOf(0) |
143 | }) | 143 | }) |
144 | 144 | ||
145 | it('Should list video channel videos of server 2 with token', async function () { | 145 | it('Should list video channel videos of server 2 with token', async function () { |
146 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5) | 146 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[1].port, 0, 5) |
147 | 147 | ||
148 | expect(res.body.total).to.equal(1) | 148 | expect(res.body.total).to.equal(1) |
149 | expect(res.body.data[0].name).to.equal('video 1 server 2') | 149 | expect(res.body.data[0].name).to.equal('video 1 server 2') |
@@ -159,7 +159,7 @@ describe('Test ActivityPub video channels search', function () { | |||
159 | // Expire video channel | 159 | // Expire video channel |
160 | await wait(10000) | 160 | await wait(10000) |
161 | 161 | ||
162 | const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' | 162 | const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' |
163 | const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) | 163 | const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) |
164 | expect(res.body.total).to.equal(1) | 164 | expect(res.body.total).to.equal(1) |
165 | expect(res.body.data).to.have.lengthOf(1) | 165 | expect(res.body.data).to.have.lengthOf(1) |
@@ -182,12 +182,12 @@ describe('Test ActivityPub video channels search', function () { | |||
182 | // Expire video channel | 182 | // Expire video channel |
183 | await wait(10000) | 183 | await wait(10000) |
184 | 184 | ||
185 | const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' | 185 | const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' |
186 | await searchVideoChannel(servers[0].url, search, servers[0].accessToken) | 186 | await searchVideoChannel(servers[0].url, search, servers[0].accessToken) |
187 | 187 | ||
188 | await waitJobs(servers) | 188 | await waitJobs(servers) |
189 | 189 | ||
190 | const videoChannelName = 'channel1_server2@localhost:' + servers[ 1 ].port | 190 | const videoChannelName = 'channel1_server2@localhost:' + servers[1].port |
191 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, videoChannelName, 0, 5, '-createdAt') | 191 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, videoChannelName, 0, 5, '-createdAt') |
192 | 192 | ||
193 | expect(res.body.total).to.equal(2) | 193 | expect(res.body.total).to.equal(2) |
@@ -204,7 +204,7 @@ describe('Test ActivityPub video channels search', function () { | |||
204 | // Expire video | 204 | // Expire video |
205 | await wait(10000) | 205 | await wait(10000) |
206 | 206 | ||
207 | const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' | 207 | const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2' |
208 | const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) | 208 | const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) |
209 | expect(res.body.total).to.equal(0) | 209 | expect(res.body.total).to.equal(0) |
210 | expect(res.body.data).to.have.lengthOf(0) | 210 | expect(res.body.data).to.have.lengthOf(0) |
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index dbfefadda..c62dfca0d 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
@@ -34,12 +34,12 @@ describe('Test ActivityPub videos search', function () { | |||
34 | await setAccessTokensToServers(servers) | 34 | await setAccessTokensToServers(servers) |
35 | 35 | ||
36 | { | 36 | { |
37 | const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video 1 on server 1' }) | 37 | const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1 on server 1' }) |
38 | videoServer1UUID = res.body.video.uuid | 38 | videoServer1UUID = res.body.video.uuid |
39 | } | 39 | } |
40 | 40 | ||
41 | { | 41 | { |
42 | const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 on server 2' }) | 42 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 on server 2' }) |
43 | videoServer2UUID = res.body.video.uuid | 43 | videoServer2UUID = res.body.video.uuid |
44 | } | 44 | } |
45 | 45 | ||
@@ -49,7 +49,7 @@ describe('Test ActivityPub videos search', function () { | |||
49 | it('Should not find a remote video', async function () { | 49 | it('Should not find a remote video', async function () { |
50 | { | 50 | { |
51 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/43' | 51 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/43' |
52 | const res = await searchVideoWithToken(servers[ 0 ].url, search, servers[ 0 ].accessToken) | 52 | const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) |
53 | 53 | ||
54 | expect(res.body.total).to.equal(0) | 54 | expect(res.body.total).to.equal(0) |
55 | expect(res.body.data).to.be.an('array') | 55 | expect(res.body.data).to.be.an('array') |
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 7882d9373..4801fe04a 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
@@ -78,7 +78,7 @@ describe('Test videos search', function () { | |||
78 | const attributes5 = immutableAssign(attributes1, { name: attributes1.name + ' - 5', licence: 2, language: undefined }) | 78 | const attributes5 = immutableAssign(attributes1, { name: attributes1.name + ' - 5', licence: 2, language: undefined }) |
79 | await uploadVideo(server.url, server.accessToken, attributes5) | 79 | await uploadVideo(server.url, server.accessToken, attributes5) |
80 | 80 | ||
81 | const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2 '] }) | 81 | const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2' ] }) |
82 | await uploadVideo(server.url, server.accessToken, attributes6) | 82 | await uploadVideo(server.url, server.accessToken, attributes6) |
83 | 83 | ||
84 | const attributes7 = immutableAssign(attributes1, { | 84 | const attributes7 = immutableAssign(attributes1, { |
@@ -269,16 +269,16 @@ describe('Test videos search', function () { | |||
269 | { | 269 | { |
270 | const res = await advancedVideosSearch(server.url, query) | 270 | const res = await advancedVideosSearch(server.url, query) |
271 | expect(res.body.total).to.equal(2) | 271 | expect(res.body.total).to.equal(2) |
272 | expect(res.body.data[ 0 ].name).to.equal('1111 2222 3333 - 3') | 272 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3') |
273 | expect(res.body.data[ 1 ].name).to.equal('1111 2222 3333 - 4') | 273 | expect(res.body.data[1].name).to.equal('1111 2222 3333 - 4') |
274 | } | 274 | } |
275 | 275 | ||
276 | { | 276 | { |
277 | const res = await advancedVideosSearch(server.url, immutableAssign(query, { languageOneOf: [ 'pl', 'en', '_unknown' ] })) | 277 | const res = await advancedVideosSearch(server.url, immutableAssign(query, { languageOneOf: [ 'pl', 'en', '_unknown' ] })) |
278 | expect(res.body.total).to.equal(3) | 278 | expect(res.body.total).to.equal(3) |
279 | expect(res.body.data[ 0 ].name).to.equal('1111 2222 3333 - 3') | 279 | expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3') |
280 | expect(res.body.data[ 1 ].name).to.equal('1111 2222 3333 - 4') | 280 | expect(res.body.data[1].name).to.equal('1111 2222 3333 - 4') |
281 | expect(res.body.data[ 2 ].name).to.equal('1111 2222 3333 - 5') | 281 | expect(res.body.data[2].name).to.equal('1111 2222 3333 - 5') |
282 | } | 282 | } |
283 | 283 | ||
284 | { | 284 | { |