diff options
Diffstat (limited to 'server/tests/api')
39 files changed, 248 insertions, 250 deletions
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts index 90c89138c..572a358a0 100644 --- a/server/tests/api/activitypub/client.ts +++ b/server/tests/api/activitypub/client.ts | |||
@@ -23,7 +23,7 @@ describe('Test activitypub', function () { | |||
23 | const object = res.body | 23 | const object = res.body |
24 | 24 | ||
25 | expect(object.type).to.equal('Person') | 25 | expect(object.type).to.equal('Person') |
26 | expect(object.id).to.equal('http://localhost:' + servers[0].port + '/accounts/root') | 26 | expect(object.id).to.equal(servers[0].url + '/accounts/root') |
27 | expect(object.name).to.equal('root') | 27 | expect(object.name).to.equal('root') |
28 | expect(object.preferredUsername).to.equal('root') | 28 | expect(object.preferredUsername).to.equal('root') |
29 | } | 29 | } |
@@ -33,7 +33,7 @@ describe('Test activitypub', function () { | |||
33 | const object = res.body | 33 | const object = res.body |
34 | 34 | ||
35 | expect(object.type).to.equal('Group') | 35 | expect(object.type).to.equal('Group') |
36 | expect(object.id).to.equal('http://localhost:' + servers[0].port + '/video-channels/root_channel') | 36 | expect(object.id).to.equal(servers[0].url + '/video-channels/root_channel') |
37 | expect(object.name).to.equal('Main root channel') | 37 | expect(object.name).to.equal('Main root channel') |
38 | expect(object.preferredUsername).to.equal('root_channel') | 38 | expect(object.preferredUsername).to.equal('root_channel') |
39 | } | 39 | } |
@@ -43,7 +43,7 @@ describe('Test activitypub', function () { | |||
43 | const object = res.body | 43 | const object = res.body |
44 | 44 | ||
45 | expect(object.type).to.equal('Video') | 45 | expect(object.type).to.equal('Video') |
46 | expect(object.id).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid) | 46 | expect(object.id).to.equal(servers[0].url + '/videos/watch/' + video.uuid) |
47 | expect(object.name).to.equal('video') | 47 | expect(object.name).to.equal('video') |
48 | } | 48 | } |
49 | 49 | ||
@@ -52,7 +52,7 @@ describe('Test activitypub', function () { | |||
52 | const object = res.body | 52 | const object = res.body |
53 | 53 | ||
54 | expect(object.type).to.equal('Playlist') | 54 | expect(object.type).to.equal('Playlist') |
55 | expect(object.id).to.equal('http://localhost:' + servers[0].port + '/video-playlists/' + playlist.uuid) | 55 | expect(object.id).to.equal(servers[0].url + '/video-playlists/' + playlist.uuid) |
56 | expect(object.name).to.equal('playlist') | 56 | expect(object.name).to.equal('playlist') |
57 | } | 57 | } |
58 | 58 | ||
@@ -110,7 +110,7 @@ describe('Test activitypub', function () { | |||
110 | it('Should redirect to the origin video object', async function () { | 110 | it('Should redirect to the origin video object', async function () { |
111 | const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + video.uuid, HttpStatusCode.FOUND_302) | 111 | const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + video.uuid, HttpStatusCode.FOUND_302) |
112 | 112 | ||
113 | expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid) | 113 | expect(res.header.location).to.equal(servers[0].url + '/videos/watch/' + video.uuid) |
114 | }) | 114 | }) |
115 | 115 | ||
116 | it('Should return the watch action', async function () { | 116 | it('Should return the watch action', async function () { |
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index 4edabd1d9..f0caea507 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts | |||
@@ -35,13 +35,13 @@ describe('Test ActivityPub fetcher', function () { | |||
35 | await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'video user' } }) | 35 | await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'video user' } }) |
36 | 36 | ||
37 | { | 37 | { |
38 | const to = 'http://localhost:' + servers[0].port + '/accounts/user1' | 38 | const to = servers[0].url + '/accounts/user1' |
39 | const value = 'http://localhost:' + servers[1].port + '/accounts/user1' | 39 | const value = servers[1].url + '/accounts/user1' |
40 | await servers[0].sql.setActorField(to, 'url', value) | 40 | await servers[0].sql.setActorField(to, 'url', value) |
41 | } | 41 | } |
42 | 42 | ||
43 | { | 43 | { |
44 | const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + uuid | 44 | const value = servers[2].url + '/videos/watch/' + uuid |
45 | await servers[0].sql.setVideoField(uuid, 'url', value) | 45 | await servers[0].sql.setVideoField(uuid, 'url', value) |
46 | } | 46 | } |
47 | }) | 47 | }) |
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index 401a09090..4fb22f512 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts | |||
@@ -112,16 +112,16 @@ describe('Test AP refresher', function () { | |||
112 | await wait(10000) | 112 | await wait(10000) |
113 | 113 | ||
114 | // Change actor name so the remote server returns a 404 | 114 | // Change actor name so the remote server returns a 404 |
115 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' | 115 | const to = servers[1].url + '/accounts/user2' |
116 | await servers[1].sql.setActorField(to, 'preferredUsername', 'toto') | 116 | await servers[1].sql.setActorField(to, 'preferredUsername', 'toto') |
117 | 117 | ||
118 | await command.get({ accountName: 'user1@localhost:' + servers[1].port }) | 118 | await command.get({ accountName: 'user1@' + servers[1].host }) |
119 | await command.get({ accountName: 'user2@localhost:' + servers[1].port }) | 119 | await command.get({ accountName: 'user2@' + servers[1].host }) |
120 | 120 | ||
121 | await waitJobs(servers) | 121 | await waitJobs(servers) |
122 | 122 | ||
123 | await command.get({ accountName: 'user1@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.OK_200 }) | 123 | await command.get({ accountName: 'user1@' + servers[1].host, expectedStatus: HttpStatusCode.OK_200 }) |
124 | await command.get({ accountName: 'user2@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 124 | await command.get({ accountName: 'user2@' + servers[1].host, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
125 | }) | 125 | }) |
126 | }) | 126 | }) |
127 | 127 | ||
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 423fefb10..22fae8331 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -11,7 +11,7 @@ import { HttpStatusCode } from '@shared/models' | |||
11 | import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands' | 11 | import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands' |
12 | 12 | ||
13 | function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) { | 13 | function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) { |
14 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 14 | const url = ofServer.url + '/accounts/peertube' |
15 | 15 | ||
16 | return Promise.all([ | 16 | return Promise.all([ |
17 | onServer.sql.setActorField(url, 'publicKey', publicKey), | 17 | onServer.sql.setActorField(url, 'publicKey', publicKey), |
@@ -20,7 +20,7 @@ function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, pu | |||
20 | } | 20 | } |
21 | 21 | ||
22 | function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) { | 22 | function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) { |
23 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 23 | const url = ofServer.url + '/accounts/peertube' |
24 | 24 | ||
25 | return Promise.all([ | 25 | return Promise.all([ |
26 | onServer.sql.setActorField(url, 'createdAt', updatedAt), | 26 | onServer.sql.setActorField(url, 'createdAt', updatedAt), |
@@ -52,7 +52,7 @@ describe('Test ActivityPub security', function () { | |||
52 | const baseHttpSignature = () => ({ | 52 | const baseHttpSignature = () => ({ |
53 | algorithm: HTTP_SIGNATURE.ALGORITHM, | 53 | algorithm: HTTP_SIGNATURE.ALGORITHM, |
54 | authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, | 54 | authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, |
55 | keyId: 'acct:peertube@localhost:' + servers[1].port, | 55 | keyId: 'acct:peertube@' + servers[1].host, |
56 | key: keys.privateKey, | 56 | key: keys.privateKey, |
57 | headers: HTTP_SIGNATURE.HEADERS_TO_SIGN | 57 | headers: HTTP_SIGNATURE.HEADERS_TO_SIGN |
58 | }) | 58 | }) |
@@ -69,8 +69,8 @@ describe('Test ActivityPub security', function () { | |||
69 | await setKeysOfServer(servers[0], servers[1], keys.publicKey, null) | 69 | await setKeysOfServer(servers[0], servers[1], keys.publicKey, null) |
70 | await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey) | 70 | await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey) |
71 | 71 | ||
72 | const to = { url: 'http://localhost:' + servers[0].port + '/accounts/peertube' } | 72 | const to = { url: servers[0].url + '/accounts/peertube' } |
73 | const by = { url: 'http://localhost:' + servers[1].port + '/accounts/peertube', privateKey: keys.privateKey } | 73 | const by = { url: servers[1].url + '/accounts/peertube', privateKey: keys.privateKey } |
74 | await makeFollowRequest(to, by) | 74 | await makeFollowRequest(to, by) |
75 | }) | 75 | }) |
76 | 76 | ||
@@ -196,8 +196,8 @@ describe('Test ActivityPub security', function () { | |||
196 | await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey) | 196 | await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey) |
197 | await setKeysOfServer(servers[2], servers[2], keys.publicKey, keys.privateKey) | 197 | await setKeysOfServer(servers[2], servers[2], keys.publicKey, keys.privateKey) |
198 | 198 | ||
199 | const to = { url: 'http://localhost:' + servers[0].port + '/accounts/peertube' } | 199 | const to = { url: servers[0].url + '/accounts/peertube' } |
200 | const by = { url: 'http://localhost:' + servers[2].port + '/accounts/peertube', privateKey: keys.privateKey } | 200 | const by = { url: servers[2].url + '/accounts/peertube', privateKey: keys.privateKey } |
201 | await makeFollowRequest(to, by) | 201 | await makeFollowRequest(to, by) |
202 | }) | 202 | }) |
203 | 203 | ||
@@ -208,9 +208,9 @@ describe('Test ActivityPub security', function () { | |||
208 | await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey) | 208 | await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey) |
209 | 209 | ||
210 | const body = getAnnounceWithoutContext(servers[1]) | 210 | const body = getAnnounceWithoutContext(servers[1]) |
211 | body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' | 211 | body.actor = servers[2].url + '/accounts/peertube' |
212 | 212 | ||
213 | const signer: any = { privateKey: invalidKeys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } | 213 | const signer: any = { privateKey: invalidKeys.privateKey, url: servers[2].url + '/accounts/peertube' } |
214 | const signedBody = await signAndContextify(signer, body, 'Announce') | 214 | const signedBody = await signAndContextify(signer, body, 'Announce') |
215 | 215 | ||
216 | const headers = buildGlobalHeaders(signedBody) | 216 | const headers = buildGlobalHeaders(signedBody) |
@@ -230,12 +230,12 @@ describe('Test ActivityPub security', function () { | |||
230 | await setKeysOfServer(servers[0], servers[2], keys.publicKey, keys.privateKey) | 230 | await setKeysOfServer(servers[0], servers[2], keys.publicKey, keys.privateKey) |
231 | 231 | ||
232 | const body = getAnnounceWithoutContext(servers[1]) | 232 | const body = getAnnounceWithoutContext(servers[1]) |
233 | body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' | 233 | body.actor = servers[2].url + '/accounts/peertube' |
234 | 234 | ||
235 | const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } | 235 | const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' } |
236 | const signedBody = await signAndContextify(signer, body, 'Announce') | 236 | const signedBody = await signAndContextify(signer, body, 'Announce') |
237 | 237 | ||
238 | signedBody.actor = 'http://localhost:' + servers[2].port + '/account/peertube' | 238 | signedBody.actor = servers[2].url + '/account/peertube' |
239 | 239 | ||
240 | const headers = buildGlobalHeaders(signedBody) | 240 | const headers = buildGlobalHeaders(signedBody) |
241 | 241 | ||
@@ -251,9 +251,9 @@ describe('Test ActivityPub security', function () { | |||
251 | this.timeout(10000) | 251 | this.timeout(10000) |
252 | 252 | ||
253 | const body = getAnnounceWithoutContext(servers[1]) | 253 | const body = getAnnounceWithoutContext(servers[1]) |
254 | body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' | 254 | body.actor = servers[2].url + '/accounts/peertube' |
255 | 255 | ||
256 | const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } | 256 | const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' } |
257 | const signedBody = await signAndContextify(signer, body, 'Announce') | 257 | const signedBody = await signAndContextify(signer, body, 'Announce') |
258 | 258 | ||
259 | const headers = buildGlobalHeaders(signedBody) | 259 | const headers = buildGlobalHeaders(signedBody) |
@@ -273,9 +273,9 @@ describe('Test ActivityPub security', function () { | |||
273 | await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey) | 273 | await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey) |
274 | 274 | ||
275 | const body = getAnnounceWithoutContext(servers[1]) | 275 | const body = getAnnounceWithoutContext(servers[1]) |
276 | body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' | 276 | body.actor = servers[2].url + '/accounts/peertube' |
277 | 277 | ||
278 | const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } | 278 | const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' } |
279 | const signedBody = await signAndContextify(signer, body, 'Announce') | 279 | const signedBody = await signAndContextify(signer, body, 'Announce') |
280 | 280 | ||
281 | const headers = buildGlobalHeaders(signedBody) | 281 | const headers = buildGlobalHeaders(signedBody) |
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts index f745b9088..169b591a3 100644 --- a/server/tests/api/check-params/blocklist.ts +++ b/server/tests/api/check-params/blocklist.ts | |||
@@ -163,7 +163,7 @@ describe('Test blocklist API validators', function () { | |||
163 | await makePostBodyRequest({ | 163 | await makePostBodyRequest({ |
164 | url: server.url, | 164 | url: server.url, |
165 | path, | 165 | path, |
166 | fields: { host: 'localhost:9002' }, | 166 | fields: { host: '127.0.0.1:9002' }, |
167 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 167 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
168 | }) | 168 | }) |
169 | }) | 169 | }) |
@@ -173,7 +173,7 @@ describe('Test blocklist API validators', function () { | |||
173 | url: server.url, | 173 | url: server.url, |
174 | token: server.accessToken, | 174 | token: server.accessToken, |
175 | path, | 175 | path, |
176 | fields: { host: 'localhost:9003' }, | 176 | fields: { host: '127.0.0.1:9003' }, |
177 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 177 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
178 | }) | 178 | }) |
179 | }) | 179 | }) |
@@ -183,7 +183,7 @@ describe('Test blocklist API validators', function () { | |||
183 | url: server.url, | 183 | url: server.url, |
184 | token: server.accessToken, | 184 | token: server.accessToken, |
185 | path, | 185 | path, |
186 | fields: { host: 'localhost:' + server.port }, | 186 | fields: { host: server.host }, |
187 | expectedStatus: HttpStatusCode.CONFLICT_409 | 187 | expectedStatus: HttpStatusCode.CONFLICT_409 |
188 | }) | 188 | }) |
189 | }) | 189 | }) |
@@ -193,7 +193,7 @@ describe('Test blocklist API validators', function () { | |||
193 | url: server.url, | 193 | url: server.url, |
194 | token: server.accessToken, | 194 | token: server.accessToken, |
195 | path, | 195 | path, |
196 | fields: { host: 'localhost:' + servers[1].port }, | 196 | fields: { host: servers[1].host }, |
197 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 197 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
198 | }) | 198 | }) |
199 | }) | 199 | }) |
@@ -203,7 +203,7 @@ describe('Test blocklist API validators', function () { | |||
203 | it('Should fail with an unauthenticated user', async function () { | 203 | it('Should fail with an unauthenticated user', async function () { |
204 | await makeDeleteRequest({ | 204 | await makeDeleteRequest({ |
205 | url: server.url, | 205 | url: server.url, |
206 | path: path + '/localhost:' + servers[1].port, | 206 | path: path + '/' + servers[1].host, |
207 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 207 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
208 | }) | 208 | }) |
209 | }) | 209 | }) |
@@ -211,7 +211,7 @@ describe('Test blocklist API validators', function () { | |||
211 | it('Should fail with an unknown server block', async function () { | 211 | it('Should fail with an unknown server block', async function () { |
212 | await makeDeleteRequest({ | 212 | await makeDeleteRequest({ |
213 | url: server.url, | 213 | url: server.url, |
214 | path: path + '/localhost:9004', | 214 | path: path + '/127.0.0.1:9004', |
215 | token: server.accessToken, | 215 | token: server.accessToken, |
216 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 216 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
217 | }) | 217 | }) |
@@ -220,7 +220,7 @@ describe('Test blocklist API validators', function () { | |||
220 | it('Should succeed with the correct params', async function () { | 220 | it('Should succeed with the correct params', async function () { |
221 | await makeDeleteRequest({ | 221 | await makeDeleteRequest({ |
222 | url: server.url, | 222 | url: server.url, |
223 | path: path + '/localhost:' + servers[1].port, | 223 | path: path + '/' + servers[1].host, |
224 | token: server.accessToken, | 224 | token: server.accessToken, |
225 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 225 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
226 | }) | 226 | }) |
@@ -393,7 +393,7 @@ describe('Test blocklist API validators', function () { | |||
393 | await makePostBodyRequest({ | 393 | await makePostBodyRequest({ |
394 | url: server.url, | 394 | url: server.url, |
395 | path, | 395 | path, |
396 | fields: { host: 'localhost:' + servers[1].port }, | 396 | fields: { host: servers[1].host }, |
397 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 397 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
398 | }) | 398 | }) |
399 | }) | 399 | }) |
@@ -403,7 +403,7 @@ describe('Test blocklist API validators', function () { | |||
403 | url: server.url, | 403 | url: server.url, |
404 | token: userAccessToken, | 404 | token: userAccessToken, |
405 | path, | 405 | path, |
406 | fields: { host: 'localhost:' + servers[1].port }, | 406 | fields: { host: servers[1].host }, |
407 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 407 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
408 | }) | 408 | }) |
409 | }) | 409 | }) |
@@ -413,7 +413,7 @@ describe('Test blocklist API validators', function () { | |||
413 | url: server.url, | 413 | url: server.url, |
414 | token: server.accessToken, | 414 | token: server.accessToken, |
415 | path, | 415 | path, |
416 | fields: { host: 'localhost:9003' }, | 416 | fields: { host: '127.0.0.1:9003' }, |
417 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 417 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
418 | }) | 418 | }) |
419 | }) | 419 | }) |
@@ -423,7 +423,7 @@ describe('Test blocklist API validators', function () { | |||
423 | url: server.url, | 423 | url: server.url, |
424 | token: server.accessToken, | 424 | token: server.accessToken, |
425 | path, | 425 | path, |
426 | fields: { host: 'localhost:' + server.port }, | 426 | fields: { host: server.host }, |
427 | expectedStatus: HttpStatusCode.CONFLICT_409 | 427 | expectedStatus: HttpStatusCode.CONFLICT_409 |
428 | }) | 428 | }) |
429 | }) | 429 | }) |
@@ -433,7 +433,7 @@ describe('Test blocklist API validators', function () { | |||
433 | url: server.url, | 433 | url: server.url, |
434 | token: server.accessToken, | 434 | token: server.accessToken, |
435 | path, | 435 | path, |
436 | fields: { host: 'localhost:' + servers[1].port }, | 436 | fields: { host: servers[1].host }, |
437 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 437 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
438 | }) | 438 | }) |
439 | }) | 439 | }) |
@@ -443,7 +443,7 @@ describe('Test blocklist API validators', function () { | |||
443 | it('Should fail with an unauthenticated user', async function () { | 443 | it('Should fail with an unauthenticated user', async function () { |
444 | await makeDeleteRequest({ | 444 | await makeDeleteRequest({ |
445 | url: server.url, | 445 | url: server.url, |
446 | path: path + '/localhost:' + servers[1].port, | 446 | path: path + '/' + servers[1].host, |
447 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 447 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
448 | }) | 448 | }) |
449 | }) | 449 | }) |
@@ -451,7 +451,7 @@ describe('Test blocklist API validators', function () { | |||
451 | it('Should fail with a user without the appropriate rights', async function () { | 451 | it('Should fail with a user without the appropriate rights', async function () { |
452 | await makeDeleteRequest({ | 452 | await makeDeleteRequest({ |
453 | url: server.url, | 453 | url: server.url, |
454 | path: path + '/localhost:' + servers[1].port, | 454 | path: path + '/' + servers[1].host, |
455 | token: userAccessToken, | 455 | token: userAccessToken, |
456 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 456 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
457 | }) | 457 | }) |
@@ -460,7 +460,7 @@ describe('Test blocklist API validators', function () { | |||
460 | it('Should fail with an unknown server block', async function () { | 460 | it('Should fail with an unknown server block', async function () { |
461 | await makeDeleteRequest({ | 461 | await makeDeleteRequest({ |
462 | url: server.url, | 462 | url: server.url, |
463 | path: path + '/localhost:9004', | 463 | path: path + '/127.0.0.1:9004', |
464 | token: server.accessToken, | 464 | token: server.accessToken, |
465 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 465 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
466 | }) | 466 | }) |
@@ -469,7 +469,7 @@ describe('Test blocklist API validators', function () { | |||
469 | it('Should succeed with the correct params', async function () { | 469 | it('Should succeed with the correct params', async function () { |
470 | await makeDeleteRequest({ | 470 | await makeDeleteRequest({ |
471 | url: server.url, | 471 | url: server.url, |
472 | path: path + '/localhost:' + servers[1].port, | 472 | path: path + '/' + servers[1].host, |
473 | token: server.accessToken, | 473 | token: server.accessToken, |
474 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 474 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
475 | }) | 475 | }) |
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts index e82688356..7968ef802 100644 --- a/server/tests/api/check-params/contact-form.ts +++ b/server/tests/api/check-params/contact-form.ts | |||
@@ -38,7 +38,7 @@ describe('Test contact form API validators', function () { | |||
38 | await killallServers([ server ]) | 38 | await killallServers([ server ]) |
39 | 39 | ||
40 | // Contact form is disabled | 40 | // Contact form is disabled |
41 | await server.run({ smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } }) | 41 | await server.run({ smtp: { hostname: '127.0.0.1', port: emailPort }, contact_form: { enabled: false } }) |
42 | await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 }) | 42 | await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 }) |
43 | }) | 43 | }) |
44 | 44 | ||
@@ -48,7 +48,7 @@ describe('Test contact form API validators', function () { | |||
48 | await killallServers([ server ]) | 48 | await killallServers([ server ]) |
49 | 49 | ||
50 | // Email & contact form enabled | 50 | // Email & contact form enabled |
51 | await server.run({ smtp: { hostname: 'localhost', port: emailPort } }) | 51 | await server.run({ smtp: { hostname: '127.0.0.1', port: emailPort } }) |
52 | 52 | ||
53 | await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 53 | await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
54 | await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 54 | await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index 56e9f8d96..3c911dcee 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts | |||
@@ -48,7 +48,7 @@ describe('Test server follows API validators', function () { | |||
48 | await makePostBodyRequest({ | 48 | await makePostBodyRequest({ |
49 | url: server.url, | 49 | url: server.url, |
50 | path, | 50 | path, |
51 | fields: { hosts: [ 'localhost:9002', 'localhost:coucou' ] }, | 51 | fields: { hosts: [ '127.0.0.1:9002', '127.0.0.1:coucou' ] }, |
52 | token: server.accessToken, | 52 | token: server.accessToken, |
53 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 53 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
54 | }) | 54 | }) |
@@ -58,7 +58,7 @@ describe('Test server follows API validators', function () { | |||
58 | await makePostBodyRequest({ | 58 | await makePostBodyRequest({ |
59 | url: server.url, | 59 | url: server.url, |
60 | path, | 60 | path, |
61 | fields: { hosts: [ 'localhost:9002', 'http://localhost:9003' ] }, | 61 | fields: { hosts: [ '127.0.0.1:9002', 'http://127.0.0.1:9003' ] }, |
62 | token: server.accessToken, | 62 | token: server.accessToken, |
63 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 63 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
64 | }) | 64 | }) |
@@ -68,7 +68,7 @@ describe('Test server follows API validators', function () { | |||
68 | await makePostBodyRequest({ | 68 | await makePostBodyRequest({ |
69 | url: server.url, | 69 | url: server.url, |
70 | path, | 70 | path, |
71 | fields: { urls: [ 'localhost:9002', 'localhost:9002' ] }, | 71 | fields: { urls: [ '127.0.0.1:9002', '127.0.0.1:9002' ] }, |
72 | token: server.accessToken, | 72 | token: server.accessToken, |
73 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 73 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
74 | }) | 74 | }) |
@@ -78,7 +78,7 @@ describe('Test server follows API validators', function () { | |||
78 | await makePostBodyRequest({ | 78 | await makePostBodyRequest({ |
79 | url: server.url, | 79 | url: server.url, |
80 | path, | 80 | path, |
81 | fields: { handles: [ 'hello@example.com', 'localhost:9001' ] }, | 81 | fields: { handles: [ 'hello@example.com', '127.0.0.1:9001' ] }, |
82 | token: server.accessToken, | 82 | token: server.accessToken, |
83 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 83 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
84 | }) | 84 | }) |
@@ -98,7 +98,7 @@ describe('Test server follows API validators', function () { | |||
98 | await makePostBodyRequest({ | 98 | await makePostBodyRequest({ |
99 | url: server.url, | 99 | url: server.url, |
100 | path, | 100 | path, |
101 | fields: { hosts: [ 'localhost:9002' ] }, | 101 | fields: { hosts: [ '127.0.0.1:9002' ] }, |
102 | token: 'fake_token', | 102 | token: 'fake_token', |
103 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 103 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
104 | }) | 104 | }) |
@@ -108,7 +108,7 @@ describe('Test server follows API validators', function () { | |||
108 | await makePostBodyRequest({ | 108 | await makePostBodyRequest({ |
109 | url: server.url, | 109 | url: server.url, |
110 | path, | 110 | path, |
111 | fields: { hosts: [ 'localhost:9002' ] }, | 111 | fields: { hosts: [ '127.0.0.1:9002' ] }, |
112 | token: userAccessToken, | 112 | token: userAccessToken, |
113 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 113 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
114 | }) | 114 | }) |
@@ -217,7 +217,7 @@ describe('Test server follows API validators', function () { | |||
217 | it('Should fail with an invalid token', async function () { | 217 | it('Should fail with an invalid token', async function () { |
218 | await makeDeleteRequest({ | 218 | await makeDeleteRequest({ |
219 | url: server.url, | 219 | url: server.url, |
220 | path: path + '/toto@localhost:9002', | 220 | path: path + '/toto@127.0.0.1:9002', |
221 | token: 'fake_token', | 221 | token: 'fake_token', |
222 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 222 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
223 | }) | 223 | }) |
@@ -226,7 +226,7 @@ describe('Test server follows API validators', function () { | |||
226 | it('Should fail if the user is not an administrator', async function () { | 226 | it('Should fail if the user is not an administrator', async function () { |
227 | await makeDeleteRequest({ | 227 | await makeDeleteRequest({ |
228 | url: server.url, | 228 | url: server.url, |
229 | path: path + '/toto@localhost:9002', | 229 | path: path + '/toto@127.0.0.1:9002', |
230 | token: userAccessToken, | 230 | token: userAccessToken, |
231 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 231 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
232 | }) | 232 | }) |
@@ -244,7 +244,7 @@ describe('Test server follows API validators', function () { | |||
244 | it('Should fail with an unknown follower', async function () { | 244 | it('Should fail with an unknown follower', async function () { |
245 | await makeDeleteRequest({ | 245 | await makeDeleteRequest({ |
246 | url: server.url, | 246 | url: server.url, |
247 | path: path + '/toto@localhost:9003', | 247 | path: path + '/toto@127.0.0.1:9003', |
248 | token: server.accessToken, | 248 | token: server.accessToken, |
249 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 249 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
250 | }) | 250 | }) |
@@ -257,7 +257,7 @@ describe('Test server follows API validators', function () { | |||
257 | it('Should fail with an invalid token', async function () { | 257 | it('Should fail with an invalid token', async function () { |
258 | await makePostBodyRequest({ | 258 | await makePostBodyRequest({ |
259 | url: server.url, | 259 | url: server.url, |
260 | path: path + '/toto@localhost:9002/accept', | 260 | path: path + '/toto@127.0.0.1:9002/accept', |
261 | token: 'fake_token', | 261 | token: 'fake_token', |
262 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 262 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
263 | }) | 263 | }) |
@@ -266,7 +266,7 @@ describe('Test server follows API validators', function () { | |||
266 | it('Should fail if the user is not an administrator', async function () { | 266 | it('Should fail if the user is not an administrator', async function () { |
267 | await makePostBodyRequest({ | 267 | await makePostBodyRequest({ |
268 | url: server.url, | 268 | url: server.url, |
269 | path: path + '/toto@localhost:9002/accept', | 269 | path: path + '/toto@127.0.0.1:9002/accept', |
270 | token: userAccessToken, | 270 | token: userAccessToken, |
271 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 271 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
272 | }) | 272 | }) |
@@ -284,7 +284,7 @@ describe('Test server follows API validators', function () { | |||
284 | it('Should fail with an unknown follower', async function () { | 284 | it('Should fail with an unknown follower', async function () { |
285 | await makePostBodyRequest({ | 285 | await makePostBodyRequest({ |
286 | url: server.url, | 286 | url: server.url, |
287 | path: path + '/toto@localhost:9003/accept', | 287 | path: path + '/toto@127.0.0.1:9003/accept', |
288 | token: server.accessToken, | 288 | token: server.accessToken, |
289 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 289 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
290 | }) | 290 | }) |
@@ -297,7 +297,7 @@ describe('Test server follows API validators', function () { | |||
297 | it('Should fail with an invalid token', async function () { | 297 | it('Should fail with an invalid token', async function () { |
298 | await makePostBodyRequest({ | 298 | await makePostBodyRequest({ |
299 | url: server.url, | 299 | url: server.url, |
300 | path: path + '/toto@localhost:9002/reject', | 300 | path: path + '/toto@127.0.0.1:9002/reject', |
301 | token: 'fake_token', | 301 | token: 'fake_token', |
302 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 302 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
303 | }) | 303 | }) |
@@ -306,7 +306,7 @@ describe('Test server follows API validators', function () { | |||
306 | it('Should fail if the user is not an administrator', async function () { | 306 | it('Should fail if the user is not an administrator', async function () { |
307 | await makePostBodyRequest({ | 307 | await makePostBodyRequest({ |
308 | url: server.url, | 308 | url: server.url, |
309 | path: path + '/toto@localhost:9002/reject', | 309 | path: path + '/toto@127.0.0.1:9002/reject', |
310 | token: userAccessToken, | 310 | token: userAccessToken, |
311 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 311 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
312 | }) | 312 | }) |
@@ -324,7 +324,7 @@ describe('Test server follows API validators', function () { | |||
324 | it('Should fail with an unknown follower', async function () { | 324 | it('Should fail with an unknown follower', async function () { |
325 | await makePostBodyRequest({ | 325 | await makePostBodyRequest({ |
326 | url: server.url, | 326 | url: server.url, |
327 | path: path + '/toto@localhost:9003/reject', | 327 | path: path + '/toto@127.0.0.1:9003/reject', |
328 | token: server.accessToken, | 328 | token: server.accessToken, |
329 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 329 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
330 | }) | 330 | }) |
@@ -337,7 +337,7 @@ describe('Test server follows API validators', function () { | |||
337 | it('Should fail with an invalid token', async function () { | 337 | it('Should fail with an invalid token', async function () { |
338 | await makeDeleteRequest({ | 338 | await makeDeleteRequest({ |
339 | url: server.url, | 339 | url: server.url, |
340 | path: path + '/localhost:9002', | 340 | path: path + '/127.0.0.1:9002', |
341 | token: 'fake_token', | 341 | token: 'fake_token', |
342 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 342 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
343 | }) | 343 | }) |
@@ -346,7 +346,7 @@ describe('Test server follows API validators', function () { | |||
346 | it('Should fail if the user is not an administrator', async function () { | 346 | it('Should fail if the user is not an administrator', async function () { |
347 | await makeDeleteRequest({ | 347 | await makeDeleteRequest({ |
348 | url: server.url, | 348 | url: server.url, |
349 | path: path + '/localhost:9002', | 349 | path: path + '/127.0.0.1:9002', |
350 | token: userAccessToken, | 350 | token: userAccessToken, |
351 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 351 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
352 | }) | 352 | }) |
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts index f45860e02..908407b9a 100644 --- a/server/tests/api/check-params/redundancy.ts +++ b/server/tests/api/check-params/redundancy.ts | |||
@@ -186,7 +186,7 @@ describe('Test server redundancy API validators', function () { | |||
186 | it('Should fail with an invalid token', async function () { | 186 | it('Should fail with an invalid token', async function () { |
187 | await makePutBodyRequest({ | 187 | await makePutBodyRequest({ |
188 | url: servers[0].url, | 188 | url: servers[0].url, |
189 | path: path + '/localhost:' + servers[1].port, | 189 | path: path + '/' + servers[1].host, |
190 | fields: { redundancyAllowed: true }, | 190 | fields: { redundancyAllowed: true }, |
191 | token: 'fake_token', | 191 | token: 'fake_token', |
192 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 192 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
@@ -196,7 +196,7 @@ describe('Test server redundancy API validators', function () { | |||
196 | it('Should fail if the user is not an administrator', async function () { | 196 | it('Should fail if the user is not an administrator', async function () { |
197 | await makePutBodyRequest({ | 197 | await makePutBodyRequest({ |
198 | url: servers[0].url, | 198 | url: servers[0].url, |
199 | path: path + '/localhost:' + servers[1].port, | 199 | path: path + '/' + servers[1].host, |
200 | fields: { redundancyAllowed: true }, | 200 | fields: { redundancyAllowed: true }, |
201 | token: userAccessToken, | 201 | token: userAccessToken, |
202 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 202 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
@@ -216,7 +216,7 @@ describe('Test server redundancy API validators', function () { | |||
216 | it('Should fail without de redundancyAllowed param', async function () { | 216 | it('Should fail without de redundancyAllowed param', async function () { |
217 | await makePutBodyRequest({ | 217 | await makePutBodyRequest({ |
218 | url: servers[0].url, | 218 | url: servers[0].url, |
219 | path: path + '/localhost:' + servers[1].port, | 219 | path: path + '/' + servers[1].host, |
220 | fields: { blabla: true }, | 220 | fields: { blabla: true }, |
221 | token: servers[0].accessToken, | 221 | token: servers[0].accessToken, |
222 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | 222 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
@@ -226,7 +226,7 @@ describe('Test server redundancy API validators', function () { | |||
226 | it('Should succeed with the correct parameters', async function () { | 226 | it('Should succeed with the correct parameters', async function () { |
227 | await makePutBodyRequest({ | 227 | await makePutBodyRequest({ |
228 | url: servers[0].url, | 228 | url: servers[0].url, |
229 | path: path + '/localhost:' + servers[1].port, | 229 | path: path + '/' + servers[1].host, |
230 | fields: { redundancyAllowed: true }, | 230 | fields: { redundancyAllowed: true }, |
231 | token: servers[0].accessToken, | 231 | token: servers[0].accessToken, |
232 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 232 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts index 0da675902..d45868f36 100644 --- a/server/tests/api/check-params/services.ts +++ b/server/tests/api/check-params/services.ts | |||
@@ -76,87 +76,87 @@ describe('Test services API validators', function () { | |||
76 | }) | 76 | }) |
77 | 77 | ||
78 | it('Should fail with an invalid element id', async function () { | 78 | it('Should fail with an invalid element id', async function () { |
79 | const embedUrl = `http://localhost:${server.port}/videos/watch/blabla` | 79 | const embedUrl = `${server.url}/videos/watch/blabla` |
80 | await checkParamEmbed(server, embedUrl) | 80 | await checkParamEmbed(server, embedUrl) |
81 | }) | 81 | }) |
82 | 82 | ||
83 | it('Should fail with an unknown element', async function () { | 83 | it('Should fail with an unknown element', async function () { |
84 | const embedUrl = `http://localhost:${server.port}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c` | 84 | const embedUrl = `${server.url}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c` |
85 | await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_FOUND_404) | 85 | await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_FOUND_404) |
86 | }) | 86 | }) |
87 | 87 | ||
88 | it('Should fail with an invalid path', async function () { | 88 | it('Should fail with an invalid path', async function () { |
89 | const embedUrl = `http://localhost:${server.port}/videos/watchs/${server.store.videoCreated.uuid}` | 89 | const embedUrl = `${server.url}/videos/watchs/${server.store.videoCreated.uuid}` |
90 | 90 | ||
91 | await checkParamEmbed(server, embedUrl) | 91 | await checkParamEmbed(server, embedUrl) |
92 | }) | 92 | }) |
93 | 93 | ||
94 | it('Should fail with an invalid max height', async function () { | 94 | it('Should fail with an invalid max height', async function () { |
95 | const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` | 95 | const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}` |
96 | 96 | ||
97 | await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' }) | 97 | await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' }) |
98 | }) | 98 | }) |
99 | 99 | ||
100 | it('Should fail with an invalid max width', async function () { | 100 | it('Should fail with an invalid max width', async function () { |
101 | const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` | 101 | const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}` |
102 | 102 | ||
103 | await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' }) | 103 | await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' }) |
104 | }) | 104 | }) |
105 | 105 | ||
106 | it('Should fail with an invalid format', async function () { | 106 | it('Should fail with an invalid format', async function () { |
107 | const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` | 107 | const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}` |
108 | 108 | ||
109 | await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' }) | 109 | await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' }) |
110 | }) | 110 | }) |
111 | 111 | ||
112 | it('Should fail with a non supported format', async function () { | 112 | it('Should fail with a non supported format', async function () { |
113 | const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` | 113 | const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}` |
114 | 114 | ||
115 | await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' }) | 115 | await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' }) |
116 | }) | 116 | }) |
117 | 117 | ||
118 | it('Should fail with a private video', async function () { | 118 | it('Should fail with a private video', async function () { |
119 | const embedUrl = `http://localhost:${server.port}/videos/watch/${privateVideo.uuid}` | 119 | const embedUrl = `${server.url}/videos/watch/${privateVideo.uuid}` |
120 | 120 | ||
121 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) | 121 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) |
122 | }) | 122 | }) |
123 | 123 | ||
124 | it('Should fail with an unlisted video with the int id', async function () { | 124 | it('Should fail with an unlisted video with the int id', async function () { |
125 | const embedUrl = `http://localhost:${server.port}/videos/watch/${unlistedVideo.id}` | 125 | const embedUrl = `${server.url}/videos/watch/${unlistedVideo.id}` |
126 | 126 | ||
127 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) | 127 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) |
128 | }) | 128 | }) |
129 | 129 | ||
130 | it('Should succeed with an unlisted video using the uuid id', async function () { | 130 | it('Should succeed with an unlisted video using the uuid id', async function () { |
131 | for (const uuid of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) { | 131 | for (const uuid of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) { |
132 | const embedUrl = `http://localhost:${server.port}/videos/watch/${uuid}` | 132 | const embedUrl = `${server.url}/videos/watch/${uuid}` |
133 | 133 | ||
134 | await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200) | 134 | await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200) |
135 | } | 135 | } |
136 | }) | 136 | }) |
137 | 137 | ||
138 | it('Should fail with a private playlist', async function () { | 138 | it('Should fail with a private playlist', async function () { |
139 | const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${privatePlaylist.uuid}` | 139 | const embedUrl = `${server.url}/videos/watch/playlist/${privatePlaylist.uuid}` |
140 | 140 | ||
141 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) | 141 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) |
142 | }) | 142 | }) |
143 | 143 | ||
144 | it('Should fail with an unlisted playlist using the int id', async function () { | 144 | it('Should fail with an unlisted playlist using the int id', async function () { |
145 | const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${unlistedPlaylist.id}` | 145 | const embedUrl = `${server.url}/videos/watch/playlist/${unlistedPlaylist.id}` |
146 | 146 | ||
147 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) | 147 | await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) |
148 | }) | 148 | }) |
149 | 149 | ||
150 | it('Should succeed with an unlisted playlist using the uuid id', async function () { | 150 | it('Should succeed with an unlisted playlist using the uuid id', async function () { |
151 | for (const uuid of [ unlistedPlaylist.uuid, unlistedPlaylist.shortUUID ]) { | 151 | for (const uuid of [ unlistedPlaylist.uuid, unlistedPlaylist.shortUUID ]) { |
152 | const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${uuid}` | 152 | const embedUrl = `${server.url}/videos/watch/playlist/${uuid}` |
153 | 153 | ||
154 | await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200) | 154 | await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200) |
155 | } | 155 | } |
156 | }) | 156 | }) |
157 | 157 | ||
158 | it('Should succeed with the correct params with a video', async function () { | 158 | it('Should succeed with the correct params with a video', async function () { |
159 | const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` | 159 | const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}` |
160 | const query = { | 160 | const query = { |
161 | format: 'json', | 161 | format: 'json', |
162 | maxheight: 400, | 162 | maxheight: 400, |
@@ -167,7 +167,7 @@ describe('Test services API validators', function () { | |||
167 | }) | 167 | }) |
168 | 168 | ||
169 | it('Should succeed with the correct params with a playlist', async function () { | 169 | it('Should succeed with the correct params with a playlist', async function () { |
170 | const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${playlistUUID}` | 170 | const embedUrl = `${server.url}/videos/watch/playlist/${playlistUUID}` |
171 | const query = { | 171 | const query = { |
172 | format: 'json', | 172 | format: 'json', |
173 | maxheight: 400, | 173 | maxheight: 400, |
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts index 7de2fda79..6a588e446 100644 --- a/server/tests/api/check-params/user-notifications.ts +++ b/server/tests/api/check-params/user-notifications.ts | |||
@@ -233,7 +233,7 @@ describe('Test user notifications API validators', function () { | |||
233 | describe('When connecting to my notification socket', function () { | 233 | describe('When connecting to my notification socket', function () { |
234 | 234 | ||
235 | it('Should fail with no token', function (next) { | 235 | it('Should fail with no token', function (next) { |
236 | const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false }) | 236 | const socket = io(`${server.url}/user-notifications`, { reconnection: false }) |
237 | 237 | ||
238 | socket.once('connect_error', function () { | 238 | socket.once('connect_error', function () { |
239 | socket.disconnect() | 239 | socket.disconnect() |
@@ -247,7 +247,7 @@ describe('Test user notifications API validators', function () { | |||
247 | }) | 247 | }) |
248 | 248 | ||
249 | it('Should fail with an invalid token', function (next) { | 249 | it('Should fail with an invalid token', function (next) { |
250 | const socket = io(`http://localhost:${server.port}/user-notifications`, { | 250 | const socket = io(`${server.url}/user-notifications`, { |
251 | query: { accessToken: 'bad_access_token' }, | 251 | query: { accessToken: 'bad_access_token' }, |
252 | reconnection: false | 252 | reconnection: false |
253 | }) | 253 | }) |
@@ -264,7 +264,7 @@ describe('Test user notifications API validators', function () { | |||
264 | }) | 264 | }) |
265 | 265 | ||
266 | it('Should success with the correct token', function (next) { | 266 | it('Should success with the correct token', function (next) { |
267 | const socket = io(`http://localhost:${server.port}/user-notifications`, { | 267 | const socket = io(`${server.url}/user-notifications`, { |
268 | query: { accessToken: server.accessToken }, | 268 | query: { accessToken: server.accessToken }, |
269 | reconnection: false | 269 | reconnection: false |
270 | }) | 270 | }) |
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts index a0e663e25..c4922c7a2 100644 --- a/server/tests/api/check-params/user-subscriptions.ts +++ b/server/tests/api/check-params/user-subscriptions.ts | |||
@@ -104,7 +104,7 @@ describe('Test user subscriptions API validators', function () { | |||
104 | await makePostBodyRequest({ | 104 | await makePostBodyRequest({ |
105 | url: server.url, | 105 | url: server.url, |
106 | path, | 106 | path, |
107 | fields: { uri: 'user1_channel@localhost:' + server.port }, | 107 | fields: { uri: 'user1_channel@' + server.host }, |
108 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 108 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
109 | }) | 109 | }) |
110 | }) | 110 | }) |
@@ -142,7 +142,7 @@ describe('Test user subscriptions API validators', function () { | |||
142 | url: server.url, | 142 | url: server.url, |
143 | path, | 143 | path, |
144 | token: server.accessToken, | 144 | token: server.accessToken, |
145 | fields: { uri: 'user1_channel@localhost:' + server.port }, | 145 | fields: { uri: 'user1_channel@' + server.host }, |
146 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 146 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
147 | }) | 147 | }) |
148 | 148 | ||
@@ -154,7 +154,7 @@ describe('Test user subscriptions API validators', function () { | |||
154 | it('Should fail with a non authenticated user', async function () { | 154 | it('Should fail with a non authenticated user', async function () { |
155 | await makeGetRequest({ | 155 | await makeGetRequest({ |
156 | url: server.url, | 156 | url: server.url, |
157 | path: path + '/user1_channel@localhost:' + server.port, | 157 | path: path + '/user1_channel@' + server.host, |
158 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 158 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
159 | }) | 159 | }) |
160 | }) | 160 | }) |
@@ -185,7 +185,7 @@ describe('Test user subscriptions API validators', function () { | |||
185 | it('Should fail with an unknown subscription', async function () { | 185 | it('Should fail with an unknown subscription', async function () { |
186 | await makeGetRequest({ | 186 | await makeGetRequest({ |
187 | url: server.url, | 187 | url: server.url, |
188 | path: path + '/root1@localhost:' + server.port, | 188 | path: path + '/root1@' + server.host, |
189 | token: server.accessToken, | 189 | token: server.accessToken, |
190 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 190 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
191 | }) | 191 | }) |
@@ -194,7 +194,7 @@ describe('Test user subscriptions API validators', function () { | |||
194 | it('Should succeed with the correct parameters', async function () { | 194 | it('Should succeed with the correct parameters', async function () { |
195 | await makeGetRequest({ | 195 | await makeGetRequest({ |
196 | url: server.url, | 196 | url: server.url, |
197 | path: path + '/user1_channel@localhost:' + server.port, | 197 | path: path + '/user1_channel@' + server.host, |
198 | token: server.accessToken, | 198 | token: server.accessToken, |
199 | expectedStatus: HttpStatusCode.OK_200 | 199 | expectedStatus: HttpStatusCode.OK_200 |
200 | }) | 200 | }) |
@@ -234,7 +234,7 @@ describe('Test user subscriptions API validators', function () { | |||
234 | await makeGetRequest({ | 234 | await makeGetRequest({ |
235 | url: server.url, | 235 | url: server.url, |
236 | path: existPath, | 236 | path: existPath, |
237 | query: { 'uris[]': 'coucou@localhost:' + server.port }, | 237 | query: { 'uris[]': 'coucou@' + server.host }, |
238 | token: server.accessToken, | 238 | token: server.accessToken, |
239 | expectedStatus: HttpStatusCode.OK_200 | 239 | expectedStatus: HttpStatusCode.OK_200 |
240 | }) | 240 | }) |
@@ -245,7 +245,7 @@ describe('Test user subscriptions API validators', function () { | |||
245 | it('Should fail with a non authenticated user', async function () { | 245 | it('Should fail with a non authenticated user', async function () { |
246 | await makeDeleteRequest({ | 246 | await makeDeleteRequest({ |
247 | url: server.url, | 247 | url: server.url, |
248 | path: path + '/user1_channel@localhost:' + server.port, | 248 | path: path + '/user1_channel@' + server.host, |
249 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | 249 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
250 | }) | 250 | }) |
251 | }) | 251 | }) |
@@ -276,7 +276,7 @@ describe('Test user subscriptions API validators', function () { | |||
276 | it('Should fail with an unknown subscription', async function () { | 276 | it('Should fail with an unknown subscription', async function () { |
277 | await makeDeleteRequest({ | 277 | await makeDeleteRequest({ |
278 | url: server.url, | 278 | url: server.url, |
279 | path: path + '/root1@localhost:' + server.port, | 279 | path: path + '/root1@' + server.host, |
280 | token: server.accessToken, | 280 | token: server.accessToken, |
281 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | 281 | expectedStatus: HttpStatusCode.NOT_FOUND_404 |
282 | }) | 282 | }) |
@@ -285,7 +285,7 @@ describe('Test user subscriptions API validators', function () { | |||
285 | it('Should succeed with the correct parameters', async function () { | 285 | it('Should succeed with the correct parameters', async function () { |
286 | await makeDeleteRequest({ | 286 | await makeDeleteRequest({ |
287 | url: server.url, | 287 | url: server.url, |
288 | path: path + '/user1_channel@localhost:' + server.port, | 288 | path: path + '/user1_channel@' + server.host, |
289 | token: server.accessToken, | 289 | token: server.accessToken, |
290 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 290 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
291 | }) | 291 | }) |
diff --git a/server/tests/api/check-params/users-admin.ts b/server/tests/api/check-params/users-admin.ts index d941ca024..7ba709c4a 100644 --- a/server/tests/api/check-params/users-admin.ts +++ b/server/tests/api/check-params/users-admin.ts | |||
@@ -158,7 +158,7 @@ describe('Test users admin API validators', function () { | |||
158 | 158 | ||
159 | const config = { | 159 | const config = { |
160 | smtp: { | 160 | smtp: { |
161 | hostname: 'localhost', | 161 | hostname: '127.0.0.1', |
162 | port: emailPort | 162 | port: emailPort |
163 | } | 163 | } |
164 | } | 164 | } |
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index 27592e8c5..47d29e7f8 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts | |||
@@ -154,7 +154,7 @@ describe('Test blocklist', function () { | |||
154 | }) | 154 | }) |
155 | 155 | ||
156 | it('Should block a remote account', async function () { | 156 | it('Should block a remote account', async function () { |
157 | await command.addToMyBlocklist({ account: 'user2@localhost:' + servers[1].port }) | 157 | await command.addToMyBlocklist({ account: 'user2@' + servers[1].host }) |
158 | }) | 158 | }) |
159 | 159 | ||
160 | it('Should hide its videos', async function () { | 160 | it('Should hide its videos', async function () { |
@@ -217,7 +217,7 @@ describe('Test blocklist', function () { | |||
217 | server: servers[0], | 217 | server: servers[0], |
218 | token: userToken1, | 218 | token: userToken1, |
219 | videoUUID: videoUUID2, | 219 | videoUUID: videoUUID2, |
220 | text: 'hello @root@localhost:' + servers[0].port | 220 | text: 'hello @root@' + servers[0].host |
221 | } | 221 | } |
222 | await checkCommentNotification(servers[0], comment, 'absence') | 222 | await checkCommentNotification(servers[0], comment, 'absence') |
223 | } | 223 | } |
@@ -237,7 +237,7 @@ describe('Test blocklist', function () { | |||
237 | expect(block.byAccount.name).to.equal('root') | 237 | expect(block.byAccount.name).to.equal('root') |
238 | expect(block.blockedAccount.displayName).to.equal('user2') | 238 | expect(block.blockedAccount.displayName).to.equal('user2') |
239 | expect(block.blockedAccount.name).to.equal('user2') | 239 | expect(block.blockedAccount.name).to.equal('user2') |
240 | expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port) | 240 | expect(block.blockedAccount.host).to.equal('' + servers[1].host) |
241 | } | 241 | } |
242 | 242 | ||
243 | { | 243 | { |
@@ -249,7 +249,7 @@ describe('Test blocklist', function () { | |||
249 | expect(block.byAccount.name).to.equal('root') | 249 | expect(block.byAccount.name).to.equal('root') |
250 | expect(block.blockedAccount.displayName).to.equal('user1') | 250 | expect(block.blockedAccount.displayName).to.equal('user1') |
251 | expect(block.blockedAccount.name).to.equal('user1') | 251 | expect(block.blockedAccount.name).to.equal('user1') |
252 | expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port) | 252 | expect(block.blockedAccount.host).to.equal('' + servers[0].host) |
253 | } | 253 | } |
254 | }) | 254 | }) |
255 | 255 | ||
@@ -347,7 +347,7 @@ describe('Test blocklist', function () { | |||
347 | }) | 347 | }) |
348 | 348 | ||
349 | it('Should unblock the remote account', async function () { | 349 | it('Should unblock the remote account', async function () { |
350 | await command.removeFromMyBlocklist({ account: 'user2@localhost:' + servers[1].port }) | 350 | await command.removeFromMyBlocklist({ account: 'user2@' + servers[1].host }) |
351 | }) | 351 | }) |
352 | 352 | ||
353 | it('Should display its videos', async function () { | 353 | it('Should display its videos', async function () { |
@@ -401,7 +401,7 @@ describe('Test blocklist', function () { | |||
401 | server: servers[0], | 401 | server: servers[0], |
402 | token: userToken1, | 402 | token: userToken1, |
403 | videoUUID: videoUUID2, | 403 | videoUUID: videoUUID2, |
404 | text: 'hello @root@localhost:' + servers[0].port | 404 | text: 'hello @root@' + servers[0].host |
405 | } | 405 | } |
406 | await checkCommentNotification(servers[0], comment, 'presence') | 406 | await checkCommentNotification(servers[0], comment, 'presence') |
407 | } | 407 | } |
@@ -419,7 +419,7 @@ describe('Test blocklist', function () { | |||
419 | }) | 419 | }) |
420 | 420 | ||
421 | it('Should block a remote server', async function () { | 421 | it('Should block a remote server', async function () { |
422 | await command.addToMyBlocklist({ server: 'localhost:' + servers[1].port }) | 422 | await command.addToMyBlocklist({ server: '' + servers[1].host }) |
423 | }) | 423 | }) |
424 | 424 | ||
425 | it('Should hide its videos', async function () { | 425 | it('Should hide its videos', async function () { |
@@ -463,7 +463,7 @@ describe('Test blocklist', function () { | |||
463 | server: servers[1], | 463 | server: servers[1], |
464 | token: userToken2, | 464 | token: userToken2, |
465 | videoUUID: videoUUID1, | 465 | videoUUID: videoUUID1, |
466 | text: 'hello @root@localhost:' + servers[0].port | 466 | text: 'hello @root@' + servers[0].host |
467 | } | 467 | } |
468 | await checkCommentNotification(servers[0], comment, 'absence') | 468 | await checkCommentNotification(servers[0], comment, 'absence') |
469 | } | 469 | } |
@@ -476,7 +476,7 @@ describe('Test blocklist', function () { | |||
476 | const block = body.data[0] | 476 | const block = body.data[0] |
477 | expect(block.byAccount.displayName).to.equal('root') | 477 | expect(block.byAccount.displayName).to.equal('root') |
478 | expect(block.byAccount.name).to.equal('root') | 478 | expect(block.byAccount.name).to.equal('root') |
479 | expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port) | 479 | expect(block.blockedServer.host).to.equal('' + servers[1].host) |
480 | }) | 480 | }) |
481 | 481 | ||
482 | it('Should search blocked servers', async function () { | 482 | it('Should search blocked servers', async function () { |
@@ -516,7 +516,7 @@ describe('Test blocklist', function () { | |||
516 | }) | 516 | }) |
517 | 517 | ||
518 | it('Should unblock the remote server', async function () { | 518 | it('Should unblock the remote server', async function () { |
519 | await command.removeFromMyBlocklist({ server: 'localhost:' + servers[1].port }) | 519 | await command.removeFromMyBlocklist({ server: '' + servers[1].host }) |
520 | }) | 520 | }) |
521 | 521 | ||
522 | it('Should display its videos', function () { | 522 | it('Should display its videos', function () { |
@@ -540,7 +540,7 @@ describe('Test blocklist', function () { | |||
540 | server: servers[1], | 540 | server: servers[1], |
541 | token: userToken2, | 541 | token: userToken2, |
542 | videoUUID: videoUUID1, | 542 | videoUUID: videoUUID1, |
543 | text: 'hello @root@localhost:' + servers[0].port | 543 | text: 'hello @root@' + servers[0].host |
544 | } | 544 | } |
545 | await checkCommentNotification(servers[0], comment, 'presence') | 545 | await checkCommentNotification(servers[0], comment, 'presence') |
546 | } | 546 | } |
@@ -564,7 +564,7 @@ describe('Test blocklist', function () { | |||
564 | }) | 564 | }) |
565 | 565 | ||
566 | it('Should block a remote account', async function () { | 566 | it('Should block a remote account', async function () { |
567 | await command.addToServerBlocklist({ account: 'user2@localhost:' + servers[1].port }) | 567 | await command.addToServerBlocklist({ account: 'user2@' + servers[1].host }) |
568 | }) | 568 | }) |
569 | 569 | ||
570 | it('Should hide its videos', async function () { | 570 | it('Should hide its videos', async function () { |
@@ -624,7 +624,7 @@ describe('Test blocklist', function () { | |||
624 | server: servers[1], | 624 | server: servers[1], |
625 | token: userToken2, | 625 | token: userToken2, |
626 | videoUUID: videoUUID1, | 626 | videoUUID: videoUUID1, |
627 | text: 'hello @root@localhost:' + servers[0].port | 627 | text: 'hello @root@' + servers[0].host |
628 | } | 628 | } |
629 | await checkCommentNotification(servers[0], comment, 'absence') | 629 | await checkCommentNotification(servers[0], comment, 'absence') |
630 | } | 630 | } |
@@ -640,7 +640,7 @@ describe('Test blocklist', function () { | |||
640 | expect(block.byAccount.name).to.equal('peertube') | 640 | expect(block.byAccount.name).to.equal('peertube') |
641 | expect(block.blockedAccount.displayName).to.equal('user2') | 641 | expect(block.blockedAccount.displayName).to.equal('user2') |
642 | expect(block.blockedAccount.name).to.equal('user2') | 642 | expect(block.blockedAccount.name).to.equal('user2') |
643 | expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port) | 643 | expect(block.blockedAccount.host).to.equal('' + servers[1].host) |
644 | } | 644 | } |
645 | 645 | ||
646 | { | 646 | { |
@@ -652,7 +652,7 @@ describe('Test blocklist', function () { | |||
652 | expect(block.byAccount.name).to.equal('peertube') | 652 | expect(block.byAccount.name).to.equal('peertube') |
653 | expect(block.blockedAccount.displayName).to.equal('user1') | 653 | expect(block.blockedAccount.displayName).to.equal('user1') |
654 | expect(block.blockedAccount.name).to.equal('user1') | 654 | expect(block.blockedAccount.name).to.equal('user1') |
655 | expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port) | 655 | expect(block.blockedAccount.host).to.equal('' + servers[0].host) |
656 | } | 656 | } |
657 | }) | 657 | }) |
658 | 658 | ||
@@ -685,7 +685,7 @@ describe('Test blocklist', function () { | |||
685 | }) | 685 | }) |
686 | 686 | ||
687 | it('Should unblock the remote account', async function () { | 687 | it('Should unblock the remote account', async function () { |
688 | await command.removeFromServerBlocklist({ account: 'user2@localhost:' + servers[1].port }) | 688 | await command.removeFromServerBlocklist({ account: 'user2@' + servers[1].host }) |
689 | }) | 689 | }) |
690 | 690 | ||
691 | it('Should display its videos', async function () { | 691 | it('Should display its videos', async function () { |
@@ -721,7 +721,7 @@ describe('Test blocklist', function () { | |||
721 | server: servers[1], | 721 | server: servers[1], |
722 | token: userToken2, | 722 | token: userToken2, |
723 | videoUUID: videoUUID1, | 723 | videoUUID: videoUUID1, |
724 | text: 'hello @root@localhost:' + servers[0].port | 724 | text: 'hello @root@' + servers[0].host |
725 | } | 725 | } |
726 | await checkCommentNotification(servers[0], comment, 'presence') | 726 | await checkCommentNotification(servers[0], comment, 'presence') |
727 | } | 727 | } |
@@ -743,7 +743,7 @@ describe('Test blocklist', function () { | |||
743 | }) | 743 | }) |
744 | 744 | ||
745 | it('Should block a remote server', async function () { | 745 | it('Should block a remote server', async function () { |
746 | await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port }) | 746 | await command.addToServerBlocklist({ server: '' + servers[1].host }) |
747 | }) | 747 | }) |
748 | 748 | ||
749 | it('Should hide its videos', async function () { | 749 | it('Should hide its videos', async function () { |
@@ -791,7 +791,7 @@ describe('Test blocklist', function () { | |||
791 | server: servers[1], | 791 | server: servers[1], |
792 | token: userToken2, | 792 | token: userToken2, |
793 | videoUUID: videoUUID1, | 793 | videoUUID: videoUUID1, |
794 | text: 'hello @root@localhost:' + servers[0].port | 794 | text: 'hello @root@' + servers[0].host |
795 | } | 795 | } |
796 | await checkCommentNotification(servers[0], comment, 'absence') | 796 | await checkCommentNotification(servers[0], comment, 'absence') |
797 | } | 797 | } |
@@ -820,7 +820,7 @@ describe('Test blocklist', function () { | |||
820 | const block = body.data[0] | 820 | const block = body.data[0] |
821 | expect(block.byAccount.displayName).to.equal('peertube') | 821 | expect(block.byAccount.displayName).to.equal('peertube') |
822 | expect(block.byAccount.name).to.equal('peertube') | 822 | expect(block.byAccount.name).to.equal('peertube') |
823 | expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port) | 823 | expect(block.blockedServer.host).to.equal('' + servers[1].host) |
824 | }) | 824 | }) |
825 | 825 | ||
826 | it('Should search blocked servers', async function () { | 826 | it('Should search blocked servers', async function () { |
@@ -848,7 +848,7 @@ describe('Test blocklist', function () { | |||
848 | }) | 848 | }) |
849 | 849 | ||
850 | it('Should unblock the remote server', async function () { | 850 | it('Should unblock the remote server', async function () { |
851 | await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) | 851 | await command.removeFromServerBlocklist({ server: '' + servers[1].host }) |
852 | }) | 852 | }) |
853 | 853 | ||
854 | it('Should list all videos', async function () { | 854 | it('Should list all videos', async function () { |
@@ -876,7 +876,7 @@ describe('Test blocklist', function () { | |||
876 | server: servers[1], | 876 | server: servers[1], |
877 | token: userToken2, | 877 | token: userToken2, |
878 | videoUUID: videoUUID1, | 878 | videoUUID: videoUUID1, |
879 | text: 'hello @root@localhost:' + servers[0].port | 879 | text: 'hello @root@' + servers[0].host |
880 | } | 880 | } |
881 | await checkCommentNotification(servers[0], comment, 'presence') | 881 | await checkCommentNotification(servers[0], comment, 'presence') |
882 | } | 882 | } |
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts index 07c981a37..6f059f622 100644 --- a/server/tests/api/notifications/admin-notifications.ts +++ b/server/tests/api/notifications/admin-notifications.ts | |||
@@ -31,7 +31,7 @@ describe('Test admin notifications', function () { | |||
31 | peertube: { | 31 | peertube: { |
32 | check_latest_version: { | 32 | check_latest_version: { |
33 | enabled: true, | 33 | enabled: true, |
34 | url: `http://localhost:${port}/versions.json` | 34 | url: `http://127.0.0.1:${port}/versions.json` |
35 | } | 35 | } |
36 | }, | 36 | }, |
37 | plugins: { | 37 | plugins: { |
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index 8b8c5712a..5a50af040 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts | |||
@@ -257,7 +257,7 @@ describe('Test comments notifications', function () { | |||
257 | 257 | ||
258 | await waitJobs(servers) | 258 | await waitJobs(servers) |
259 | 259 | ||
260 | const text1 = `hello @user_1@localhost:${servers[0].port} 1` | 260 | const text1 = `hello @user_1@${servers[0].host} 1` |
261 | const { id: server2ThreadId } = await servers[1].comments.createThread({ videoId: uuid, text: text1 }) | 261 | const { id: server2ThreadId } = await servers[1].comments.createThread({ videoId: uuid, text: text1 }) |
262 | 262 | ||
263 | await waitJobs(servers) | 263 | await waitJobs(servers) |
@@ -269,7 +269,7 @@ describe('Test comments notifications', function () { | |||
269 | const threadId = data[0].id | 269 | const threadId = data[0].id |
270 | await checkCommentMention({ ...baseParams, shortUUID, commentId: threadId, threadId, byAccountDisplayName, checkType: 'presence' }) | 270 | await checkCommentMention({ ...baseParams, shortUUID, commentId: threadId, threadId, byAccountDisplayName, checkType: 'presence' }) |
271 | 271 | ||
272 | const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}` | 272 | const text2 = `@user_1@${servers[0].host} hello 2 @root@${servers[0].host}` |
273 | await servers[1].comments.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 }) | 273 | await servers[1].comments.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 }) |
274 | 274 | ||
275 | await waitJobs(servers) | 275 | await waitJobs(servers) |
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index 5a632fb22..b127a7a31 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts | |||
@@ -373,7 +373,7 @@ describe('Test moderation notifications', function () { | |||
373 | followings: { | 373 | followings: { |
374 | instance: { | 374 | instance: { |
375 | autoFollowIndex: { | 375 | autoFollowIndex: { |
376 | indexUrl: `http://localhost:${port}/api/v1/instances/hosts`, | 376 | indexUrl: `http://127.0.0.1:${port}/api/v1/instances/hosts`, |
377 | enabled: true | 377 | enabled: true |
378 | } | 378 | } |
379 | } | 379 | } |
@@ -388,10 +388,10 @@ describe('Test moderation notifications', function () { | |||
388 | 388 | ||
389 | await waitJobs(servers) | 389 | await waitJobs(servers) |
390 | 390 | ||
391 | await checkNewInstanceFollower({ ...baseParams, followerHost: 'localhost:' + servers[2].port, checkType: 'presence' }) | 391 | await checkNewInstanceFollower({ ...baseParams, followerHost: servers[2].host, checkType: 'presence' }) |
392 | 392 | ||
393 | const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } } | 393 | const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } } |
394 | await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: 'localhost:' + servers[2].port, checkType: 'absence' }) | 394 | await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: servers[2].host, checkType: 'absence' }) |
395 | }) | 395 | }) |
396 | 396 | ||
397 | it('Should send a notification on auto follow back', async function () { | 397 | it('Should send a notification on auto follow back', async function () { |
@@ -495,8 +495,8 @@ describe('Test moderation notifications', function () { | |||
495 | autoBlacklistTestsCustomConfig.transcoding.enabled = true | 495 | autoBlacklistTestsCustomConfig.transcoding.enabled = true |
496 | await servers[0].config.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig }) | 496 | await servers[0].config.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig }) |
497 | 497 | ||
498 | await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) | 498 | await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host }) |
499 | await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) | 499 | await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host }) |
500 | }) | 500 | }) |
501 | 501 | ||
502 | it('Should send notification to moderators on new video with auto-blacklist', async function () { | 502 | it('Should send notification to moderators on new video with auto-blacklist', async function () { |
@@ -615,8 +615,8 @@ describe('Test moderation notifications', function () { | |||
615 | after(async () => { | 615 | after(async () => { |
616 | await servers[0].config.updateCustomConfig({ newCustomConfig: currentCustomConfig }) | 616 | await servers[0].config.updateCustomConfig({ newCustomConfig: currentCustomConfig }) |
617 | 617 | ||
618 | await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) | 618 | await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host }) |
619 | await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) | 619 | await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host }) |
620 | }) | 620 | }) |
621 | }) | 621 | }) |
622 | 622 | ||
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index f194656c9..1fc861160 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts | |||
@@ -26,7 +26,7 @@ describe('Test notifications API', function () { | |||
26 | userNotifications = res.userNotifications | 26 | userNotifications = res.userNotifications |
27 | server = res.servers[0] | 27 | server = res.servers[0] |
28 | 28 | ||
29 | await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port }) | 29 | await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@' + server.host }) |
30 | 30 | ||
31 | for (let i = 0; i < 10; i++) { | 31 | for (let i = 0; i < 10; i++) { |
32 | await server.videos.randomUpload({ wait: false }) | 32 | await server.videos.randomUpload({ wait: false }) |
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index ceadc21ff..c6087b1eb 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts | |||
@@ -69,7 +69,7 @@ describe('Test user notifications', function () { | |||
69 | it('Should send a new video notification if the user follows the local video publisher', async function () { | 69 | it('Should send a new video notification if the user follows the local video publisher', async function () { |
70 | this.timeout(15000) | 70 | this.timeout(15000) |
71 | 71 | ||
72 | await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port }) | 72 | await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[0].host }) |
73 | await waitJobs(servers) | 73 | await waitJobs(servers) |
74 | 74 | ||
75 | const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1) | 75 | const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1) |
@@ -79,7 +79,7 @@ describe('Test user notifications', function () { | |||
79 | it('Should send a new video notification from a remote account', async function () { | 79 | it('Should send a new video notification from a remote account', async function () { |
80 | this.timeout(150000) // Server 2 has transcoding enabled | 80 | this.timeout(150000) // Server 2 has transcoding enabled |
81 | 81 | ||
82 | await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port }) | 82 | await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[1].host }) |
83 | await waitJobs(servers) | 83 | await waitJobs(servers) |
84 | 84 | ||
85 | const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2) | 85 | const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2) |
@@ -509,7 +509,7 @@ describe('Test user notifications', function () { | |||
509 | it('Should notify when a local channel is following one of our channel', async function () { | 509 | it('Should notify when a local channel is following one of our channel', async function () { |
510 | this.timeout(50000) | 510 | this.timeout(50000) |
511 | 511 | ||
512 | await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) | 512 | await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host }) |
513 | await waitJobs(servers) | 513 | await waitJobs(servers) |
514 | 514 | ||
515 | await checkNewActorFollow({ | 515 | await checkNewActorFollow({ |
@@ -521,13 +521,13 @@ describe('Test user notifications', function () { | |||
521 | checkType: 'presence' | 521 | checkType: 'presence' |
522 | }) | 522 | }) |
523 | 523 | ||
524 | await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) | 524 | await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host }) |
525 | }) | 525 | }) |
526 | 526 | ||
527 | it('Should notify when a remote channel is following one of our channel', async function () { | 527 | it('Should notify when a remote channel is following one of our channel', async function () { |
528 | this.timeout(50000) | 528 | this.timeout(50000) |
529 | 529 | ||
530 | await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) | 530 | await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host }) |
531 | await waitJobs(servers) | 531 | await waitJobs(servers) |
532 | 532 | ||
533 | await checkNewActorFollow({ | 533 | await checkNewActorFollow({ |
@@ -539,14 +539,14 @@ describe('Test user notifications', function () { | |||
539 | checkType: 'presence' | 539 | checkType: 'presence' |
540 | }) | 540 | }) |
541 | 541 | ||
542 | await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) | 542 | await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host }) |
543 | }) | 543 | }) |
544 | 544 | ||
545 | // PeerTube does not support account -> account follows | 545 | // PeerTube does not support account -> account follows |
546 | // it('Should notify when a local account is following one of our channel', async function () { | 546 | // it('Should notify when a local account is following one of our channel', async function () { |
547 | // this.timeout(50000) | 547 | // this.timeout(50000) |
548 | // | 548 | // |
549 | // await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port) | 549 | // await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@' + servers[0].host) |
550 | // | 550 | // |
551 | // await waitJobs(servers) | 551 | // await waitJobs(servers) |
552 | // | 552 | // |
@@ -556,7 +556,7 @@ describe('Test user notifications', function () { | |||
556 | // it('Should notify when a remote account is following one of our channel', async function () { | 556 | // it('Should notify when a remote account is following one of our channel', async function () { |
557 | // this.timeout(50000) | 557 | // this.timeout(50000) |
558 | // | 558 | // |
559 | // await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port) | 559 | // await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@' + servers[0].host) |
560 | // | 560 | // |
561 | // await waitJobs(servers) | 561 | // await waitJobs(servers) |
562 | // | 562 | // |
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts index d1875febb..1b3c389d7 100644 --- a/server/tests/api/object-storage/videos.ts +++ b/server/tests/api/object-storage/videos.ts | |||
@@ -139,7 +139,7 @@ function runTestSuite (options: { | |||
139 | this.timeout(120000) | 139 | this.timeout(120000) |
140 | 140 | ||
141 | const port = await mockObjectStorage.initialize() | 141 | const port = await mockObjectStorage.initialize() |
142 | baseMockUrl = options.useMockBaseUrl ? `http://localhost:${port}` : undefined | 142 | baseMockUrl = options.useMockBaseUrl ? `http://127.0.0.1:${port}` : undefined |
143 | 143 | ||
144 | await ObjectStorageCommand.createMockBucket(options.playlistBucket) | 144 | await ObjectStorageCommand.createMockBucket(options.playlistBucket) |
145 | await ObjectStorageCommand.createMockBucket(options.webtorrentBucket) | 145 | await ObjectStorageCommand.createMockBucket(options.webtorrentBucket) |
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index fb2e6e91c..57939775e 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -265,8 +265,8 @@ async function checkStatsWithoutRedundancy (strategy: VideoRedundancyStrategyWit | |||
265 | async function findServerFollows () { | 265 | async function findServerFollows () { |
266 | const body = await servers[0].follows.getFollowings({ start: 0, count: 5, sort: '-createdAt' }) | 266 | const body = await servers[0].follows.getFollowings({ start: 0, count: 5, sort: '-createdAt' }) |
267 | const follows = body.data | 267 | const follows = body.data |
268 | const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`) | 268 | const server2 = follows.find(f => f.following.host === `${servers[1].host}`) |
269 | const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`) | 269 | const server3 = follows.find(f => f.following.host === `${servers[2].host}`) |
270 | 270 | ||
271 | return { server2, server3 } | 271 | return { server2, server3 } |
272 | } | 272 | } |
@@ -639,12 +639,12 @@ describe('Test videos redundancy', function () { | |||
639 | await wait(10000) | 639 | await wait(10000) |
640 | 640 | ||
641 | try { | 641 | try { |
642 | await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port) | 642 | await checkContains(servers, 'http%3A%2F%2F' + servers[0].hostname + '%3A' + servers[0].port) |
643 | } catch { | 643 | } catch { |
644 | // Maybe a server deleted a redundancy in the scheduler | 644 | // Maybe a server deleted a redundancy in the scheduler |
645 | await wait(2000) | 645 | await wait(2000) |
646 | 646 | ||
647 | await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port) | 647 | await checkContains(servers, 'http%3A%2F%2F' + servers[0].hostname + '%3A' + servers[0].port) |
648 | } | 648 | } |
649 | }) | 649 | }) |
650 | 650 | ||
@@ -655,7 +655,7 @@ describe('Test videos redundancy', function () { | |||
655 | 655 | ||
656 | await wait(15000) | 656 | await wait(15000) |
657 | 657 | ||
658 | await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A' + servers[0].port) | 658 | await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2F' + servers[0].port + '%3A' + servers[0].port) |
659 | }) | 659 | }) |
660 | 660 | ||
661 | after(async function () { | 661 | after(async function () { |
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 8173c8b60..003bd34d0 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts | |||
@@ -87,7 +87,7 @@ describe('Test ActivityPub video channels search', function () { | |||
87 | it('Should search a local video channel', async function () { | 87 | it('Should search a local video channel', async function () { |
88 | const searches = [ | 88 | const searches = [ |
89 | servers[0].url + '/video-channels/channel1_server1', | 89 | servers[0].url + '/video-channels/channel1_server1', |
90 | 'channel1_server1@localhost:' + servers[0].port | 90 | 'channel1_server1@' + servers[0].host |
91 | ] | 91 | ] |
92 | 92 | ||
93 | for (const search of searches) { | 93 | for (const search of searches) { |
@@ -139,7 +139,7 @@ describe('Test ActivityPub video channels search', function () { | |||
139 | servers[1].url + '/video-channels/channel1_server2', | 139 | servers[1].url + '/video-channels/channel1_server2', |
140 | servers[1].url + '/c/channel1_server2', | 140 | servers[1].url + '/c/channel1_server2', |
141 | servers[1].url + '/c/channel1_server2/videos', | 141 | servers[1].url + '/c/channel1_server2/videos', |
142 | 'channel1_server2@localhost:' + servers[1].port | 142 | 'channel1_server2@' + servers[1].host |
143 | ] | 143 | ] |
144 | 144 | ||
145 | for (const search of searches) { | 145 | for (const search of searches) { |
@@ -169,7 +169,7 @@ describe('Test ActivityPub video channels search', function () { | |||
169 | 169 | ||
170 | const { total, data } = await servers[0].videos.listByChannel({ | 170 | const { total, data } = await servers[0].videos.listByChannel({ |
171 | token: null, | 171 | token: null, |
172 | handle: 'channel1_server2@localhost:' + servers[1].port | 172 | handle: 'channel1_server2@' + servers[1].host |
173 | }) | 173 | }) |
174 | expect(total).to.equal(0) | 174 | expect(total).to.equal(0) |
175 | expect(data).to.have.lengthOf(0) | 175 | expect(data).to.have.lengthOf(0) |
@@ -177,7 +177,7 @@ describe('Test ActivityPub video channels search', function () { | |||
177 | 177 | ||
178 | it('Should list video channel videos of server 2 with token', async function () { | 178 | it('Should list video channel videos of server 2 with token', async function () { |
179 | const { total, data } = await servers[0].videos.listByChannel({ | 179 | const { total, data } = await servers[0].videos.listByChannel({ |
180 | handle: 'channel1_server2@localhost:' + servers[1].port | 180 | handle: 'channel1_server2@' + servers[1].host |
181 | }) | 181 | }) |
182 | 182 | ||
183 | expect(total).to.equal(1) | 183 | expect(total).to.equal(1) |
@@ -226,7 +226,7 @@ describe('Test ActivityPub video channels search', function () { | |||
226 | 226 | ||
227 | await waitJobs(servers) | 227 | await waitJobs(servers) |
228 | 228 | ||
229 | const handle = 'channel1_server2@localhost:' + servers[1].port | 229 | const handle = 'channel1_server2@' + servers[1].host |
230 | const { total, data } = await servers[0].videos.listByChannel({ handle, sort: '-createdAt' }) | 230 | const { total, data } = await servers[0].videos.listByChannel({ handle, sort: '-createdAt' }) |
231 | 231 | ||
232 | expect(total).to.equal(2) | 232 | expect(total).to.equal(2) |
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index eae4391ec..c8be762d2 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts | |||
@@ -57,7 +57,7 @@ describe('Test index search', function () { | |||
57 | 57 | ||
58 | expect(body.total).to.equal(1) | 58 | expect(body.total).to.equal(1) |
59 | expect(body.data[0].name).to.equal('root_channel') | 59 | expect(body.data[0].name).to.equal('root_channel') |
60 | expect(body.data[0].host).to.equal('localhost:' + server.port) | 60 | expect(body.data[0].host).to.equal(server.host) |
61 | }) | 61 | }) |
62 | 62 | ||
63 | it('Should make an index videos search by default', async function () { | 63 | it('Should make an index videos search by default', async function () { |
diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts index cdaadb3ad..99d5c3142 100644 --- a/server/tests/api/server/auto-follows.ts +++ b/server/tests/api/server/auto-follows.ts | |||
@@ -150,7 +150,7 @@ describe('Test auto follows', function () { | |||
150 | followings: { | 150 | followings: { |
151 | instance: { | 151 | instance: { |
152 | autoFollowIndex: { | 152 | autoFollowIndex: { |
153 | indexUrl: `http://localhost:${port}/api/v1/instances/hosts`, | 153 | indexUrl: `http://127.0.0.1:${port}/api/v1/instances/hosts`, |
154 | enabled: true | 154 | enabled: true |
155 | } | 155 | } |
156 | } | 156 | } |
diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts index 7c8b40cbe..1fe26bb26 100644 --- a/server/tests/api/server/bulk.ts +++ b/server/tests/api/server/bulk.ts | |||
@@ -77,7 +77,7 @@ describe('Test bulk actions', function () { | |||
77 | const { data } = await servers[1].comments.listThreads({ videoId: video.id }) | 77 | const { data } = await servers[1].comments.listThreads({ videoId: video.id }) |
78 | const comment = data.find(c => c.text === 'comment by user 3') | 78 | const comment = data.find(c => c.text === 'comment by user 3') |
79 | 79 | ||
80 | if (video.account.host === 'localhost:' + servers[0].port) { | 80 | if (video.account.host === servers[0].host) { |
81 | expect(comment).to.not.exist | 81 | expect(comment).to.not.exist |
82 | } else { | 82 | } else { |
83 | expect(comment).to.exist | 83 | expect(comment).to.exist |
@@ -151,7 +151,7 @@ describe('Test bulk actions', function () { | |||
151 | 151 | ||
152 | await bulkCommand.removeCommentsOf({ | 152 | await bulkCommand.removeCommentsOf({ |
153 | attributes: { | 153 | attributes: { |
154 | accountName: 'user3@localhost:' + servers[1].port, | 154 | accountName: 'user3@' + servers[1].host, |
155 | scope: 'instance' | 155 | scope: 'instance' |
156 | } | 156 | } |
157 | }) | 157 | }) |
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index fcd7f3c4c..325218008 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts | |||
@@ -25,7 +25,7 @@ describe('Test contact form', function () { | |||
25 | 25 | ||
26 | const overrideConfig = { | 26 | const overrideConfig = { |
27 | smtp: { | 27 | smtp: { |
28 | hostname: 'localhost', | 28 | hostname: '127.0.0.1', |
29 | port | 29 | port |
30 | } | 30 | } |
31 | } | 31 | } |
@@ -51,7 +51,7 @@ describe('Test contact form', function () { | |||
51 | 51 | ||
52 | const email = emails[0] | 52 | const email = emails[0] |
53 | 53 | ||
54 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 54 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
55 | expect(email['replyTo'][0]['address']).equal('toto@example.com') | 55 | expect(email['replyTo'][0]['address']).equal('toto@example.com') |
56 | expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') | 56 | expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') |
57 | expect(email['subject']).contains('my subject') | 57 | expect(email['subject']).contains('my subject') |
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 1826c268a..4ab5463fe 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts | |||
@@ -33,7 +33,7 @@ describe('Test emails', function () { | |||
33 | 33 | ||
34 | const overrideConfig = { | 34 | const overrideConfig = { |
35 | smtp: { | 35 | smtp: { |
36 | hostname: 'localhost', | 36 | hostname: '127.0.0.1', |
37 | port: emailPort | 37 | port: emailPort |
38 | } | 38 | } |
39 | } | 39 | } |
@@ -66,8 +66,6 @@ describe('Test emails', function () { | |||
66 | describe('When resetting user password', function () { | 66 | describe('When resetting user password', function () { |
67 | 67 | ||
68 | it('Should ask to reset the password', async function () { | 68 | it('Should ask to reset the password', async function () { |
69 | this.timeout(10000) | ||
70 | |||
71 | await server.users.askResetPassword({ email: 'user_1@example.com' }) | 69 | await server.users.askResetPassword({ email: 'user_1@example.com' }) |
72 | 70 | ||
73 | await waitJobs(server) | 71 | await waitJobs(server) |
@@ -76,7 +74,7 @@ describe('Test emails', function () { | |||
76 | const email = emails[0] | 74 | const email = emails[0] |
77 | 75 | ||
78 | expect(email['from'][0]['name']).equal('PeerTube') | 76 | expect(email['from'][0]['name']).equal('PeerTube') |
79 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 77 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
80 | expect(email['to'][0]['address']).equal('user_1@example.com') | 78 | expect(email['to'][0]['address']).equal('user_1@example.com') |
81 | expect(email['subject']).contains('password') | 79 | expect(email['subject']).contains('password') |
82 | 80 | ||
@@ -135,7 +133,7 @@ describe('Test emails', function () { | |||
135 | const email = emails[1] | 133 | const email = emails[1] |
136 | 134 | ||
137 | expect(email['from'][0]['name']).equal('PeerTube') | 135 | expect(email['from'][0]['name']).equal('PeerTube') |
138 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 136 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
139 | expect(email['to'][0]['address']).equal('create_password@example.com') | 137 | expect(email['to'][0]['address']).equal('create_password@example.com') |
140 | expect(email['subject']).contains('account') | 138 | expect(email['subject']).contains('account') |
141 | expect(email['subject']).contains('password') | 139 | expect(email['subject']).contains('password') |
@@ -191,7 +189,7 @@ describe('Test emails', function () { | |||
191 | const email = emails[2] | 189 | const email = emails[2] |
192 | 190 | ||
193 | expect(email['from'][0]['name']).equal('PeerTube') | 191 | expect(email['from'][0]['name']).equal('PeerTube') |
194 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 192 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
195 | expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') | 193 | expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') |
196 | expect(email['subject']).contains('abuse') | 194 | expect(email['subject']).contains('abuse') |
197 | expect(email['text']).contains(videoShortUUID) | 195 | expect(email['text']).contains(videoShortUUID) |
@@ -212,7 +210,7 @@ describe('Test emails', function () { | |||
212 | const email = emails[3] | 210 | const email = emails[3] |
213 | 211 | ||
214 | expect(email['from'][0]['name']).equal('PeerTube') | 212 | expect(email['from'][0]['name']).equal('PeerTube') |
215 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 213 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
216 | expect(email['to'][0]['address']).equal('user_1@example.com') | 214 | expect(email['to'][0]['address']).equal('user_1@example.com') |
217 | expect(email['subject']).contains(' blocked') | 215 | expect(email['subject']).contains(' blocked') |
218 | expect(email['text']).contains(' blocked') | 216 | expect(email['text']).contains(' blocked') |
@@ -230,7 +228,7 @@ describe('Test emails', function () { | |||
230 | const email = emails[4] | 228 | const email = emails[4] |
231 | 229 | ||
232 | expect(email['from'][0]['name']).equal('PeerTube') | 230 | expect(email['from'][0]['name']).equal('PeerTube') |
233 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 231 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
234 | expect(email['to'][0]['address']).equal('user_1@example.com') | 232 | expect(email['to'][0]['address']).equal('user_1@example.com') |
235 | expect(email['subject']).contains(' unblocked') | 233 | expect(email['subject']).contains(' unblocked') |
236 | expect(email['text']).contains(' unblocked') | 234 | expect(email['text']).contains(' unblocked') |
@@ -250,7 +248,7 @@ describe('Test emails', function () { | |||
250 | const email = emails[5] | 248 | const email = emails[5] |
251 | 249 | ||
252 | expect(email['from'][0]['name']).equal('PeerTube') | 250 | expect(email['from'][0]['name']).equal('PeerTube') |
253 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 251 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
254 | expect(email['to'][0]['address']).equal('user_1@example.com') | 252 | expect(email['to'][0]['address']).equal('user_1@example.com') |
255 | expect(email['subject']).contains(' blacklisted') | 253 | expect(email['subject']).contains(' blacklisted') |
256 | expect(email['text']).contains('my super user video') | 254 | expect(email['text']).contains('my super user video') |
@@ -268,7 +266,7 @@ describe('Test emails', function () { | |||
268 | const email = emails[6] | 266 | const email = emails[6] |
269 | 267 | ||
270 | expect(email['from'][0]['name']).equal('PeerTube') | 268 | expect(email['from'][0]['name']).equal('PeerTube') |
271 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 269 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
272 | expect(email['to'][0]['address']).equal('user_1@example.com') | 270 | expect(email['to'][0]['address']).equal('user_1@example.com') |
273 | expect(email['subject']).contains(' unblacklisted') | 271 | expect(email['subject']).contains(' unblacklisted') |
274 | expect(email['text']).contains('my super user video') | 272 | expect(email['text']).contains('my super user video') |
@@ -293,7 +291,7 @@ describe('Test emails', function () { | |||
293 | const email = emails[7] | 291 | const email = emails[7] |
294 | 292 | ||
295 | expect(email['from'][0]['name']).equal('PeerTube') | 293 | expect(email['from'][0]['name']).equal('PeerTube') |
296 | expect(email['from'][0]['address']).equal('test-admin@localhost') | 294 | expect(email['from'][0]['address']).equal('test-admin@127.0.0.1') |
297 | expect(email['to'][0]['address']).equal('user_1@example.com') | 295 | expect(email['to'][0]['address']).equal('user_1@example.com') |
298 | expect(email['subject']).contains('Verify') | 296 | expect(email['subject']).contains('Verify') |
299 | 297 | ||
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts index e1ec2b069..ff5332858 100644 --- a/server/tests/api/server/follow-constraints.ts +++ b/server/tests/api/server/follow-constraints.ts | |||
@@ -57,21 +57,21 @@ describe('Test follow constraints', function () { | |||
57 | }) | 57 | }) |
58 | 58 | ||
59 | it('Should list local account videos', async function () { | 59 | it('Should list local account videos', async function () { |
60 | const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[0].port }) | 60 | const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@' + servers[0].host }) |
61 | 61 | ||
62 | expect(total).to.equal(1) | 62 | expect(total).to.equal(1) |
63 | expect(data).to.have.lengthOf(1) | 63 | expect(data).to.have.lengthOf(1) |
64 | }) | 64 | }) |
65 | 65 | ||
66 | it('Should list remote account videos', async function () { | 66 | it('Should list remote account videos', async function () { |
67 | const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[1].port }) | 67 | const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@' + servers[1].host }) |
68 | 68 | ||
69 | expect(total).to.equal(1) | 69 | expect(total).to.equal(1) |
70 | expect(data).to.have.lengthOf(1) | 70 | expect(data).to.have.lengthOf(1) |
71 | }) | 71 | }) |
72 | 72 | ||
73 | it('Should list local channel videos', async function () { | 73 | it('Should list local channel videos', async function () { |
74 | const handle = 'root_channel@localhost:' + servers[0].port | 74 | const handle = 'root_channel@' + servers[0].host |
75 | const { total, data } = await servers[0].videos.listByChannel({ handle }) | 75 | const { total, data } = await servers[0].videos.listByChannel({ handle }) |
76 | 76 | ||
77 | expect(total).to.equal(1) | 77 | expect(total).to.equal(1) |
@@ -79,7 +79,7 @@ describe('Test follow constraints', function () { | |||
79 | }) | 79 | }) |
80 | 80 | ||
81 | it('Should list remote channel videos', async function () { | 81 | it('Should list remote channel videos', async function () { |
82 | const handle = 'root_channel@localhost:' + servers[1].port | 82 | const handle = 'root_channel@' + servers[1].host |
83 | const { total, data } = await servers[0].videos.listByChannel({ handle }) | 83 | const { total, data } = await servers[0].videos.listByChannel({ handle }) |
84 | 84 | ||
85 | expect(total).to.equal(1) | 85 | expect(total).to.equal(1) |
@@ -97,21 +97,21 @@ describe('Test follow constraints', function () { | |||
97 | }) | 97 | }) |
98 | 98 | ||
99 | it('Should list local account videos', async function () { | 99 | it('Should list local account videos', async function () { |
100 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port }) | 100 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[0].host }) |
101 | 101 | ||
102 | expect(total).to.equal(1) | 102 | expect(total).to.equal(1) |
103 | expect(data).to.have.lengthOf(1) | 103 | expect(data).to.have.lengthOf(1) |
104 | }) | 104 | }) |
105 | 105 | ||
106 | it('Should list remote account videos', async function () { | 106 | it('Should list remote account videos', async function () { |
107 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port }) | 107 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[1].host }) |
108 | 108 | ||
109 | expect(total).to.equal(1) | 109 | expect(total).to.equal(1) |
110 | expect(data).to.have.lengthOf(1) | 110 | expect(data).to.have.lengthOf(1) |
111 | }) | 111 | }) |
112 | 112 | ||
113 | it('Should list local channel videos', async function () { | 113 | it('Should list local channel videos', async function () { |
114 | const handle = 'root_channel@localhost:' + servers[0].port | 114 | const handle = 'root_channel@' + servers[0].host |
115 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) | 115 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) |
116 | 116 | ||
117 | expect(total).to.equal(1) | 117 | expect(total).to.equal(1) |
@@ -119,7 +119,7 @@ describe('Test follow constraints', function () { | |||
119 | }) | 119 | }) |
120 | 120 | ||
121 | it('Should list remote channel videos', async function () { | 121 | it('Should list remote channel videos', async function () { |
122 | const handle = 'root_channel@localhost:' + servers[1].port | 122 | const handle = 'root_channel@' + servers[1].host |
123 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) | 123 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) |
124 | 124 | ||
125 | expect(total).to.equal(1) | 125 | expect(total).to.equal(1) |
@@ -161,7 +161,7 @@ describe('Test follow constraints', function () { | |||
161 | it('Should list local account videos', async function () { | 161 | it('Should list local account videos', async function () { |
162 | const { total, data } = await servers[0].videos.listByAccount({ | 162 | const { total, data } = await servers[0].videos.listByAccount({ |
163 | token: null, | 163 | token: null, |
164 | handle: 'root@localhost:' + servers[0].port | 164 | handle: 'root@' + servers[0].host |
165 | }) | 165 | }) |
166 | 166 | ||
167 | expect(total).to.equal(1) | 167 | expect(total).to.equal(1) |
@@ -171,7 +171,7 @@ describe('Test follow constraints', function () { | |||
171 | it('Should not list remote account videos', async function () { | 171 | it('Should not list remote account videos', async function () { |
172 | const { total, data } = await servers[0].videos.listByAccount({ | 172 | const { total, data } = await servers[0].videos.listByAccount({ |
173 | token: null, | 173 | token: null, |
174 | handle: 'root@localhost:' + servers[1].port | 174 | handle: 'root@' + servers[1].host |
175 | }) | 175 | }) |
176 | 176 | ||
177 | expect(total).to.equal(0) | 177 | expect(total).to.equal(0) |
@@ -179,7 +179,7 @@ describe('Test follow constraints', function () { | |||
179 | }) | 179 | }) |
180 | 180 | ||
181 | it('Should list local channel videos', async function () { | 181 | it('Should list local channel videos', async function () { |
182 | const handle = 'root_channel@localhost:' + servers[0].port | 182 | const handle = 'root_channel@' + servers[0].host |
183 | const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) | 183 | const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) |
184 | 184 | ||
185 | expect(total).to.equal(1) | 185 | expect(total).to.equal(1) |
@@ -187,7 +187,7 @@ describe('Test follow constraints', function () { | |||
187 | }) | 187 | }) |
188 | 188 | ||
189 | it('Should not list remote channel videos', async function () { | 189 | it('Should not list remote channel videos', async function () { |
190 | const handle = 'root_channel@localhost:' + servers[1].port | 190 | const handle = 'root_channel@' + servers[1].host |
191 | const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) | 191 | const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) |
192 | 192 | ||
193 | expect(total).to.equal(0) | 193 | expect(total).to.equal(0) |
@@ -206,21 +206,21 @@ describe('Test follow constraints', function () { | |||
206 | }) | 206 | }) |
207 | 207 | ||
208 | it('Should list local account videos', async function () { | 208 | it('Should list local account videos', async function () { |
209 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port }) | 209 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[0].host }) |
210 | 210 | ||
211 | expect(total).to.equal(1) | 211 | expect(total).to.equal(1) |
212 | expect(data).to.have.lengthOf(1) | 212 | expect(data).to.have.lengthOf(1) |
213 | }) | 213 | }) |
214 | 214 | ||
215 | it('Should list remote account videos', async function () { | 215 | it('Should list remote account videos', async function () { |
216 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port }) | 216 | const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[1].host }) |
217 | 217 | ||
218 | expect(total).to.equal(1) | 218 | expect(total).to.equal(1) |
219 | expect(data).to.have.lengthOf(1) | 219 | expect(data).to.have.lengthOf(1) |
220 | }) | 220 | }) |
221 | 221 | ||
222 | it('Should list local channel videos', async function () { | 222 | it('Should list local channel videos', async function () { |
223 | const handle = 'root_channel@localhost:' + servers[0].port | 223 | const handle = 'root_channel@' + servers[0].host |
224 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) | 224 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) |
225 | 225 | ||
226 | expect(total).to.equal(1) | 226 | expect(total).to.equal(1) |
@@ -228,7 +228,7 @@ describe('Test follow constraints', function () { | |||
228 | }) | 228 | }) |
229 | 229 | ||
230 | it('Should list remote channel videos', async function () { | 230 | it('Should list remote channel videos', async function () { |
231 | const handle = 'root_channel@localhost:' + servers[1].port | 231 | const handle = 'root_channel@' + servers[1].host |
232 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) | 232 | const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) |
233 | 233 | ||
234 | expect(total).to.equal(1) | 234 | expect(total).to.equal(1) |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 96d39352b..6a2cc2c43 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -88,7 +88,7 @@ describe('Test follows', function () { | |||
88 | const follows = body.data | 88 | const follows = body.data |
89 | expect(follows).to.be.an('array') | 89 | expect(follows).to.be.an('array') |
90 | expect(follows).to.have.lengthOf(1) | 90 | expect(follows).to.have.lengthOf(1) |
91 | expect(follows[0].follower.host).to.equal('localhost:' + servers[0].port) | 91 | expect(follows[0].follower.host).to.equal(servers[0].host) |
92 | }) | 92 | }) |
93 | 93 | ||
94 | it('Should have 0 followers on server 1 and 2', async function () { | 94 | it('Should have 0 followers on server 1 and 2', async function () { |
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 9ace65ddf..1fb4d18f9 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -62,7 +62,7 @@ describe('Test handle downs', function () { | |||
62 | support: 'my super support text for server 1', | 62 | support: 'my super support text for server 1', |
63 | account: { | 63 | account: { |
64 | name: 'root', | 64 | name: 'root', |
65 | host: 'localhost:' + servers[0].port | 65 | host: servers[0].host |
66 | }, | 66 | }, |
67 | isLocal: false, | 67 | isLocal: false, |
68 | duration: 10, | 68 | duration: 10, |
@@ -151,7 +151,7 @@ describe('Test handle downs', function () { | |||
151 | const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' }) | 151 | const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' }) |
152 | expect(body.data).to.be.an('array') | 152 | expect(body.data).to.be.an('array') |
153 | expect(body.data).to.have.lengthOf(1) | 153 | expect(body.data).to.have.lengthOf(1) |
154 | expect(body.data[0].follower.host).to.equal('localhost:' + servers[2].port) | 154 | expect(body.data[0].follower.host).to.equal(servers[2].host) |
155 | }) | 155 | }) |
156 | 156 | ||
157 | it('Should not have pending/processing jobs anymore', async function () { | 157 | it('Should not have pending/processing jobs anymore', async function () { |
diff --git a/server/tests/api/server/open-telemetry.ts b/server/tests/api/server/open-telemetry.ts index 7a294be82..db76a3d7f 100644 --- a/server/tests/api/server/open-telemetry.ts +++ b/server/tests/api/server/open-telemetry.ts | |||
@@ -9,7 +9,7 @@ describe('Open Telemetry', function () { | |||
9 | let server: PeerTubeServer | 9 | let server: PeerTubeServer |
10 | 10 | ||
11 | describe('Metrics', function () { | 11 | describe('Metrics', function () { |
12 | const metricsUrl = 'http://localhost:9092/metrics' | 12 | const metricsUrl = 'http://127.0.0.1:9092/metrics' |
13 | 13 | ||
14 | it('Should not enable open telemetry metrics', async function () { | 14 | it('Should not enable open telemetry metrics', async function () { |
15 | this.timeout(60000) | 15 | this.timeout(60000) |
@@ -92,7 +92,7 @@ describe('Open Telemetry', function () { | |||
92 | tracing: { | 92 | tracing: { |
93 | enabled: true, | 93 | enabled: true, |
94 | jaeger_exporter: { | 94 | jaeger_exporter: { |
95 | endpoint: 'http://localhost:' + mockPort | 95 | endpoint: 'http://127.0.0.1:' + mockPort |
96 | } | 96 | } |
97 | } | 97 | } |
98 | } | 98 | } |
diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index 71c444efd..de8872d74 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.ts | |||
@@ -20,7 +20,7 @@ describe('Test proxy', function () { | |||
20 | let proxy: MockProxy | 20 | let proxy: MockProxy |
21 | 21 | ||
22 | const goodEnv = { HTTP_PROXY: '' } | 22 | const goodEnv = { HTTP_PROXY: '' } |
23 | const badEnv = { HTTP_PROXY: 'http://localhost:9000' } | 23 | const badEnv = { HTTP_PROXY: 'http://127.0.0.1:9000' } |
24 | 24 | ||
25 | before(async function () { | 25 | before(async function () { |
26 | this.timeout(120000) | 26 | this.timeout(120000) |
@@ -30,7 +30,7 @@ describe('Test proxy', function () { | |||
30 | const proxyPort = await proxy.initialize() | 30 | const proxyPort = await proxy.initialize() |
31 | servers = await createMultipleServers(2) | 31 | servers = await createMultipleServers(2) |
32 | 32 | ||
33 | goodEnv.HTTP_PROXY = 'http://localhost:' + proxyPort | 33 | goodEnv.HTTP_PROXY = 'http://127.0.0.1:' + proxyPort |
34 | 34 | ||
35 | await setAccessTokensToServers(servers) | 35 | await setAccessTokensToServers(servers) |
36 | await setDefaultVideoChannel(servers) | 36 | await setDefaultVideoChannel(servers) |
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index fbeca7d67..b45cfe67e 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts | |||
@@ -63,8 +63,8 @@ describe('Test users subscriptions', function () { | |||
63 | it('User of server 1 should follow user of server 3 and root of server 1', async function () { | 63 | it('User of server 1 should follow user of server 3 and root of server 1', async function () { |
64 | this.timeout(60000) | 64 | this.timeout(60000) |
65 | 65 | ||
66 | await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) | 66 | await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host }) |
67 | await command.add({ token: users[0].accessToken, targetUri: 'root_channel@localhost:' + servers[0].port }) | 67 | await command.add({ token: users[0].accessToken, targetUri: 'root_channel@' + servers[0].host }) |
68 | 68 | ||
69 | await waitJobs(servers) | 69 | await waitJobs(servers) |
70 | 70 | ||
@@ -112,20 +112,20 @@ describe('Test users subscriptions', function () { | |||
112 | 112 | ||
113 | it('Should get subscription', async function () { | 113 | it('Should get subscription', async function () { |
114 | { | 114 | { |
115 | const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port }) | 115 | const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host }) |
116 | 116 | ||
117 | expect(videoChannel.name).to.equal('user3_channel') | 117 | expect(videoChannel.name).to.equal('user3_channel') |
118 | expect(videoChannel.host).to.equal('localhost:' + servers[2].port) | 118 | expect(videoChannel.host).to.equal(servers[2].host) |
119 | expect(videoChannel.displayName).to.equal('Main user3 channel') | 119 | expect(videoChannel.displayName).to.equal('Main user3 channel') |
120 | expect(videoChannel.followingCount).to.equal(0) | 120 | expect(videoChannel.followingCount).to.equal(0) |
121 | expect(videoChannel.followersCount).to.equal(1) | 121 | expect(videoChannel.followersCount).to.equal(1) |
122 | } | 122 | } |
123 | 123 | ||
124 | { | 124 | { |
125 | const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port }) | 125 | const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host }) |
126 | 126 | ||
127 | expect(videoChannel.name).to.equal('root_channel') | 127 | expect(videoChannel.name).to.equal('root_channel') |
128 | expect(videoChannel.host).to.equal('localhost:' + servers[0].port) | 128 | expect(videoChannel.host).to.equal(servers[0].host) |
129 | expect(videoChannel.displayName).to.equal('Main root channel') | 129 | expect(videoChannel.displayName).to.equal('Main root channel') |
130 | expect(videoChannel.followingCount).to.equal(0) | 130 | expect(videoChannel.followingCount).to.equal(0) |
131 | expect(videoChannel.followersCount).to.equal(1) | 131 | expect(videoChannel.followersCount).to.equal(1) |
@@ -134,18 +134,18 @@ describe('Test users subscriptions', function () { | |||
134 | 134 | ||
135 | it('Should return the existing subscriptions', async function () { | 135 | it('Should return the existing subscriptions', async function () { |
136 | const uris = [ | 136 | const uris = [ |
137 | 'user3_channel@localhost:' + servers[2].port, | 137 | 'user3_channel@' + servers[2].host, |
138 | 'root2_channel@localhost:' + servers[0].port, | 138 | 'root2_channel@' + servers[0].host, |
139 | 'root_channel@localhost:' + servers[0].port, | 139 | 'root_channel@' + servers[0].host, |
140 | 'user3_channel@localhost:' + servers[0].port | 140 | 'user3_channel@' + servers[0].host |
141 | ] | 141 | ] |
142 | 142 | ||
143 | const body = await command.exist({ token: users[0].accessToken, uris }) | 143 | const body = await command.exist({ token: users[0].accessToken, uris }) |
144 | 144 | ||
145 | expect(body['user3_channel@localhost:' + servers[2].port]).to.be.true | 145 | expect(body['user3_channel@' + servers[2].host]).to.be.true |
146 | expect(body['root2_channel@localhost:' + servers[0].port]).to.be.false | 146 | expect(body['root2_channel@' + servers[0].host]).to.be.false |
147 | expect(body['root_channel@localhost:' + servers[0].port]).to.be.true | 147 | expect(body['root_channel@' + servers[0].host]).to.be.true |
148 | expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false | 148 | expect(body['user3_channel@' + servers[0].host]).to.be.false |
149 | }) | 149 | }) |
150 | 150 | ||
151 | it('Should search among subscriptions', async function () { | 151 | it('Should search among subscriptions', async function () { |
@@ -305,7 +305,7 @@ describe('Test users subscriptions', function () { | |||
305 | it('Should remove user of server 3 subscription', async function () { | 305 | it('Should remove user of server 3 subscription', async function () { |
306 | this.timeout(30000) | 306 | this.timeout(30000) |
307 | 307 | ||
308 | await command.remove({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port }) | 308 | await command.remove({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host }) |
309 | 309 | ||
310 | await waitJobs(servers) | 310 | await waitJobs(servers) |
311 | }) | 311 | }) |
@@ -324,7 +324,7 @@ describe('Test users subscriptions', function () { | |||
324 | it('Should remove the root subscription and not display the videos anymore', async function () { | 324 | it('Should remove the root subscription and not display the videos anymore', async function () { |
325 | this.timeout(30000) | 325 | this.timeout(30000) |
326 | 326 | ||
327 | await command.remove({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port }) | 327 | await command.remove({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host }) |
328 | 328 | ||
329 | await waitJobs(servers) | 329 | await waitJobs(servers) |
330 | 330 | ||
@@ -355,7 +355,7 @@ describe('Test users subscriptions', function () { | |||
355 | it('Should follow user of server 3 again', async function () { | 355 | it('Should follow user of server 3 again', async function () { |
356 | this.timeout(60000) | 356 | this.timeout(60000) |
357 | 357 | ||
358 | await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) | 358 | await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host }) |
359 | 359 | ||
360 | await waitJobs(servers) | 360 | await waitJobs(servers) |
361 | 361 | ||
@@ -389,8 +389,8 @@ describe('Test users subscriptions', function () { | |||
389 | 389 | ||
390 | await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } }) | 390 | await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } }) |
391 | 391 | ||
392 | await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) | 392 | await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@' + servers[2].host }) |
393 | await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@localhost:' + servers[2].port }) | 393 | await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@' + servers[2].host }) |
394 | 394 | ||
395 | await waitJobs(servers) | 395 | await waitJobs(servers) |
396 | }) | 396 | }) |
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 188e6f137..f94191b04 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts | |||
@@ -111,7 +111,7 @@ describe('Test users with multiple servers', function () { | |||
111 | for (const server of servers) { | 111 | for (const server of servers) { |
112 | const body = await server.accounts.list({ sort: '-createdAt' }) | 112 | const body = await server.accounts.list({ sort: '-createdAt' }) |
113 | 113 | ||
114 | const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) | 114 | const resList = body.data.find(a => a.name === 'root' && a.host === servers[0].host) |
115 | expect(resList).not.to.be.undefined | 115 | expect(resList).not.to.be.undefined |
116 | 116 | ||
117 | const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host }) | 117 | const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host }) |
@@ -119,7 +119,7 @@ describe('Test users with multiple servers', function () { | |||
119 | if (!createdAt) createdAt = account.createdAt | 119 | if (!createdAt) createdAt = account.createdAt |
120 | 120 | ||
121 | expect(account.name).to.equal('root') | 121 | expect(account.name).to.equal('root') |
122 | expect(account.host).to.equal('localhost:' + servers[0].port) | 122 | expect(account.host).to.equal(servers[0].host) |
123 | expect(account.displayName).to.equal('my super display name') | 123 | expect(account.displayName).to.equal('my super display name') |
124 | expect(account.description).to.equal('my super description updated') | 124 | expect(account.description).to.equal('my super description updated') |
125 | expect(createdAt).to.equal(account.createdAt) | 125 | expect(createdAt).to.equal(account.createdAt) |
@@ -138,7 +138,7 @@ describe('Test users with multiple servers', function () { | |||
138 | 138 | ||
139 | it('Should list account videos', async function () { | 139 | it('Should list account videos', async function () { |
140 | for (const server of servers) { | 140 | for (const server of servers) { |
141 | const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port }) | 141 | const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host }) |
142 | 142 | ||
143 | expect(total).to.equal(1) | 143 | expect(total).to.equal(1) |
144 | expect(data).to.be.an('array') | 144 | expect(data).to.be.an('array') |
@@ -155,7 +155,7 @@ describe('Test users with multiple servers', function () { | |||
155 | await waitJobs(servers) | 155 | await waitJobs(servers) |
156 | 156 | ||
157 | for (const server of servers) { | 157 | for (const server of servers) { |
158 | const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port, search: 'Kami' }) | 158 | const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host, search: 'Kami' }) |
159 | 159 | ||
160 | expect(total).to.equal(1) | 160 | expect(total).to.equal(1) |
161 | expect(data).to.be.an('array') | 161 | expect(data).to.be.an('array') |
@@ -170,11 +170,11 @@ describe('Test users with multiple servers', function () { | |||
170 | for (const server of servers) { | 170 | for (const server of servers) { |
171 | const body = await server.accounts.list({ sort: '-createdAt' }) | 171 | const body = await server.accounts.list({ sort: '-createdAt' }) |
172 | 172 | ||
173 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) | 173 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host) |
174 | expect(accountDeleted).not.to.be.undefined | 174 | expect(accountDeleted).not.to.be.undefined |
175 | 175 | ||
176 | const { data } = await server.channels.list() | 176 | const { data } = await server.channels.list() |
177 | const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) | 177 | const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === servers[0].host) |
178 | expect(videoChannelDeleted).not.to.be.undefined | 178 | expect(videoChannelDeleted).not.to.be.undefined |
179 | } | 179 | } |
180 | 180 | ||
@@ -185,11 +185,11 @@ describe('Test users with multiple servers', function () { | |||
185 | for (const server of servers) { | 185 | for (const server of servers) { |
186 | const body = await server.accounts.list({ sort: '-createdAt' }) | 186 | const body = await server.accounts.list({ sort: '-createdAt' }) |
187 | 187 | ||
188 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) | 188 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host) |
189 | expect(accountDeleted).to.be.undefined | 189 | expect(accountDeleted).to.be.undefined |
190 | 190 | ||
191 | const { data } = await server.channels.list() | 191 | const { data } = await server.channels.list() |
192 | const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) | 192 | const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === servers[0].host) |
193 | expect(videoChannelDeleted).to.be.undefined | 193 | expect(videoChannelDeleted).to.be.undefined |
194 | } | 194 | } |
195 | }) | 195 | }) |
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index fc082383a..19a8df9e1 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts | |||
@@ -28,7 +28,7 @@ describe('Test users account verification', function () { | |||
28 | 28 | ||
29 | const overrideConfig = { | 29 | const overrideConfig = { |
30 | smtp: { | 30 | smtp: { |
31 | hostname: 'localhost', | 31 | hostname: '127.0.0.1', |
32 | port | 32 | port |
33 | } | 33 | } |
34 | } | 34 | } |
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 2ad749fd4..ff730287a 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -105,7 +105,7 @@ describe('Test multiple servers', function () { | |||
105 | originallyPublishedAt: '2019-02-10T13:38:14.449Z', | 105 | originallyPublishedAt: '2019-02-10T13:38:14.449Z', |
106 | account: { | 106 | account: { |
107 | name: 'root', | 107 | name: 'root', |
108 | host: 'localhost:' + servers[0].port | 108 | host: servers[0].host |
109 | }, | 109 | }, |
110 | isLocal, | 110 | isLocal, |
111 | publishedAt, | 111 | publishedAt, |
@@ -185,7 +185,7 @@ describe('Test multiple servers', function () { | |||
185 | 185 | ||
186 | // All servers should have this video | 186 | // All servers should have this video |
187 | for (const server of servers) { | 187 | for (const server of servers) { |
188 | const isLocal = server.url === 'http://localhost:' + servers[1].port | 188 | const isLocal = server.url === servers[1].url |
189 | const checkAttributes = { | 189 | const checkAttributes = { |
190 | name: 'my super name for server 2', | 190 | name: 'my super name for server 2', |
191 | category: 4, | 191 | category: 4, |
@@ -196,7 +196,7 @@ describe('Test multiple servers', function () { | |||
196 | support: 'my super support text for server 2', | 196 | support: 'my super support text for server 2', |
197 | account: { | 197 | account: { |
198 | name: 'user1', | 198 | name: 'user1', |
199 | host: 'localhost:' + servers[1].port | 199 | host: servers[1].host |
200 | }, | 200 | }, |
201 | isLocal, | 201 | isLocal, |
202 | commentsEnabled: true, | 202 | commentsEnabled: true, |
@@ -279,7 +279,7 @@ describe('Test multiple servers', function () { | |||
279 | 279 | ||
280 | // All servers should have this video | 280 | // All servers should have this video |
281 | for (const server of servers) { | 281 | for (const server of servers) { |
282 | const isLocal = server.url === 'http://localhost:' + servers[2].port | 282 | const isLocal = server.url === servers[2].url |
283 | const { data } = await server.videos.list() | 283 | const { data } = await server.videos.list() |
284 | 284 | ||
285 | expect(data).to.be.an('array') | 285 | expect(data).to.be.an('array') |
@@ -306,7 +306,7 @@ describe('Test multiple servers', function () { | |||
306 | support: 'my super support text for server 3', | 306 | support: 'my super support text for server 3', |
307 | account: { | 307 | account: { |
308 | name: 'root', | 308 | name: 'root', |
309 | host: 'localhost:' + servers[2].port | 309 | host: servers[2].host |
310 | }, | 310 | }, |
311 | isLocal, | 311 | isLocal, |
312 | duration: 5, | 312 | duration: 5, |
@@ -340,7 +340,7 @@ describe('Test multiple servers', function () { | |||
340 | support: 'my super support text for server 3-2', | 340 | support: 'my super support text for server 3-2', |
341 | account: { | 341 | account: { |
342 | name: 'root', | 342 | name: 'root', |
343 | host: 'localhost:' + servers[2].port | 343 | host: servers[2].host |
344 | }, | 344 | }, |
345 | commentsEnabled: true, | 345 | commentsEnabled: true, |
346 | downloadEnabled: true, | 346 | downloadEnabled: true, |
@@ -649,7 +649,7 @@ describe('Test multiple servers', function () { | |||
649 | 649 | ||
650 | expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin) | 650 | expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin) |
651 | 651 | ||
652 | const isLocal = server.url === 'http://localhost:' + servers[2].port | 652 | const isLocal = server.url === servers[2].url |
653 | const checkAttributes = { | 653 | const checkAttributes = { |
654 | name: 'my super video updated', | 654 | name: 'my super video updated', |
655 | category: 10, | 655 | category: 10, |
@@ -661,7 +661,7 @@ describe('Test multiple servers', function () { | |||
661 | originallyPublishedAt: '2019-02-11T13:38:14.449Z', | 661 | originallyPublishedAt: '2019-02-11T13:38:14.449Z', |
662 | account: { | 662 | account: { |
663 | name: 'root', | 663 | name: 'root', |
664 | host: 'localhost:' + servers[2].port | 664 | host: servers[2].host |
665 | }, | 665 | }, |
666 | isLocal, | 666 | isLocal, |
667 | duration: 5, | 667 | duration: 5, |
@@ -830,7 +830,7 @@ describe('Test multiple servers', function () { | |||
830 | expect(comment).to.not.be.undefined | 830 | expect(comment).to.not.be.undefined |
831 | expect(comment.inReplyToCommentId).to.be.null | 831 | expect(comment.inReplyToCommentId).to.be.null |
832 | expect(comment.account.name).to.equal('root') | 832 | expect(comment.account.name).to.equal('root') |
833 | expect(comment.account.host).to.equal('localhost:' + servers[0].port) | 833 | expect(comment.account.host).to.equal(servers[0].host) |
834 | expect(comment.totalReplies).to.equal(3) | 834 | expect(comment.totalReplies).to.equal(3) |
835 | expect(dateIsValid(comment.createdAt as string)).to.be.true | 835 | expect(dateIsValid(comment.createdAt as string)).to.be.true |
836 | expect(dateIsValid(comment.updatedAt as string)).to.be.true | 836 | expect(dateIsValid(comment.updatedAt as string)).to.be.true |
@@ -841,7 +841,7 @@ describe('Test multiple servers', function () { | |||
841 | expect(comment).to.not.be.undefined | 841 | expect(comment).to.not.be.undefined |
842 | expect(comment.inReplyToCommentId).to.be.null | 842 | expect(comment.inReplyToCommentId).to.be.null |
843 | expect(comment.account.name).to.equal('root') | 843 | expect(comment.account.name).to.equal('root') |
844 | expect(comment.account.host).to.equal('localhost:' + servers[2].port) | 844 | expect(comment.account.host).to.equal(servers[2].host) |
845 | expect(comment.totalReplies).to.equal(0) | 845 | expect(comment.totalReplies).to.equal(0) |
846 | expect(dateIsValid(comment.createdAt as string)).to.be.true | 846 | expect(dateIsValid(comment.createdAt as string)).to.be.true |
847 | expect(dateIsValid(comment.updatedAt as string)).to.be.true | 847 | expect(dateIsValid(comment.updatedAt as string)).to.be.true |
@@ -858,25 +858,25 @@ describe('Test multiple servers', function () { | |||
858 | 858 | ||
859 | expect(tree.comment.text).equal('my super first comment') | 859 | expect(tree.comment.text).equal('my super first comment') |
860 | expect(tree.comment.account.name).equal('root') | 860 | expect(tree.comment.account.name).equal('root') |
861 | expect(tree.comment.account.host).equal('localhost:' + servers[0].port) | 861 | expect(tree.comment.account.host).equal(servers[0].host) |
862 | expect(tree.children).to.have.lengthOf(2) | 862 | expect(tree.children).to.have.lengthOf(2) |
863 | 863 | ||
864 | const firstChild = tree.children[0] | 864 | const firstChild = tree.children[0] |
865 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') | 865 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') |
866 | expect(firstChild.comment.account.name).equal('root') | 866 | expect(firstChild.comment.account.name).equal('root') |
867 | expect(firstChild.comment.account.host).equal('localhost:' + servers[1].port) | 867 | expect(firstChild.comment.account.host).equal(servers[1].host) |
868 | expect(firstChild.children).to.have.lengthOf(1) | 868 | expect(firstChild.children).to.have.lengthOf(1) |
869 | 869 | ||
870 | childOfFirstChild = firstChild.children[0] | 870 | childOfFirstChild = firstChild.children[0] |
871 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') | 871 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') |
872 | expect(childOfFirstChild.comment.account.name).equal('root') | 872 | expect(childOfFirstChild.comment.account.name).equal('root') |
873 | expect(childOfFirstChild.comment.account.host).equal('localhost:' + servers[2].port) | 873 | expect(childOfFirstChild.comment.account.host).equal(servers[2].host) |
874 | expect(childOfFirstChild.children).to.have.lengthOf(0) | 874 | expect(childOfFirstChild.children).to.have.lengthOf(0) |
875 | 875 | ||
876 | const secondChild = tree.children[1] | 876 | const secondChild = tree.children[1] |
877 | expect(secondChild.comment.text).to.equal('my second answer to thread 1') | 877 | expect(secondChild.comment.text).to.equal('my second answer to thread 1') |
878 | expect(secondChild.comment.account.name).equal('root') | 878 | expect(secondChild.comment.account.name).equal('root') |
879 | expect(secondChild.comment.account.host).equal('localhost:' + servers[2].port) | 879 | expect(secondChild.comment.account.host).equal(servers[2].host) |
880 | expect(secondChild.children).to.have.lengthOf(0) | 880 | expect(secondChild.children).to.have.lengthOf(0) |
881 | } | 881 | } |
882 | }) | 882 | }) |
@@ -935,7 +935,7 @@ describe('Test multiple servers', function () { | |||
935 | expect(comment).to.not.be.undefined | 935 | expect(comment).to.not.be.undefined |
936 | expect(comment.inReplyToCommentId).to.be.null | 936 | expect(comment.inReplyToCommentId).to.be.null |
937 | expect(comment.account.name).to.equal('root') | 937 | expect(comment.account.name).to.equal('root') |
938 | expect(comment.account.host).to.equal('localhost:' + servers[2].port) | 938 | expect(comment.account.host).to.equal(servers[2].host) |
939 | expect(comment.totalReplies).to.equal(0) | 939 | expect(comment.totalReplies).to.equal(0) |
940 | expect(dateIsValid(comment.createdAt as string)).to.be.true | 940 | expect(dateIsValid(comment.createdAt as string)).to.be.true |
941 | expect(dateIsValid(comment.updatedAt as string)).to.be.true | 941 | expect(dateIsValid(comment.updatedAt as string)).to.be.true |
@@ -1042,7 +1042,7 @@ describe('Test multiple servers', function () { | |||
1042 | const { data } = await server.videos.list() | 1042 | const { data } = await server.videos.list() |
1043 | const video = data.find(v => v.name === 'minimum parameters') | 1043 | const video = data.find(v => v.name === 'minimum parameters') |
1044 | 1044 | ||
1045 | const isLocal = server.url === 'http://localhost:' + servers[1].port | 1045 | const isLocal = server.url === servers[1].url |
1046 | const checkAttributes = { | 1046 | const checkAttributes = { |
1047 | name: 'minimum parameters', | 1047 | name: 'minimum parameters', |
1048 | category: null, | 1048 | category: null, |
@@ -1053,7 +1053,7 @@ describe('Test multiple servers', function () { | |||
1053 | support: null, | 1053 | support: null, |
1054 | account: { | 1054 | account: { |
1055 | name: 'root', | 1055 | name: 'root', |
1056 | host: 'localhost:' + servers[1].port | 1056 | host: servers[1].host |
1057 | }, | 1057 | }, |
1058 | isLocal, | 1058 | isLocal, |
1059 | duration: 5, | 1059 | duration: 5, |
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index da8bde07b..e8e981e55 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -33,7 +33,7 @@ describe('Test a single server', function () { | |||
33 | support: 'my super support text', | 33 | support: 'my super support text', |
34 | account: { | 34 | account: { |
35 | name: 'root', | 35 | name: 'root', |
36 | host: 'localhost:' + server.port | 36 | host: server.host |
37 | }, | 37 | }, |
38 | isLocal: true, | 38 | isLocal: true, |
39 | duration: 5, | 39 | duration: 5, |
@@ -66,7 +66,7 @@ describe('Test a single server', function () { | |||
66 | support: 'my super support text updated', | 66 | support: 'my super support text updated', |
67 | account: { | 67 | account: { |
68 | name: 'root', | 68 | name: 'root', |
69 | host: 'localhost:' + server.port | 69 | host: server.host |
70 | }, | 70 | }, |
71 | isLocal: true, | 71 | isLocal: true, |
72 | tags: [ 'tagup1', 'tagup2' ], | 72 | tags: [ 'tagup1', 'tagup2' ], |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 86a8a038c..64bd4d9ae 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -373,7 +373,7 @@ describe('Test video channels', function () { | |||
373 | this.timeout(10000) | 373 | this.timeout(10000) |
374 | 374 | ||
375 | for (const server of servers) { | 375 | for (const server of servers) { |
376 | const channelURI = 'second_video_channel@localhost:' + servers[0].port | 376 | const channelURI = 'second_video_channel@' + servers[0].host |
377 | const { total, data } = await server.videos.listByChannel({ handle: channelURI }) | 377 | const { total, data } = await server.videos.listByChannel({ handle: channelURI }) |
378 | 378 | ||
379 | expect(total).to.equal(1) | 379 | expect(total).to.equal(1) |
@@ -396,13 +396,13 @@ describe('Test video channels', function () { | |||
396 | 396 | ||
397 | for (const server of servers) { | 397 | for (const server of servers) { |
398 | { | 398 | { |
399 | const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port | 399 | const secondChannelURI = 'second_video_channel@' + servers[0].host |
400 | const { total } = await server.videos.listByChannel({ handle: secondChannelURI }) | 400 | const { total } = await server.videos.listByChannel({ handle: secondChannelURI }) |
401 | expect(total).to.equal(0) | 401 | expect(total).to.equal(0) |
402 | } | 402 | } |
403 | 403 | ||
404 | { | 404 | { |
405 | const channelURI = 'root_channel@localhost:' + servers[0].port | 405 | const channelURI = 'root_channel@' + servers[0].host |
406 | const { total, data } = await server.videos.listByChannel({ handle: channelURI }) | 406 | const { total, data } = await server.videos.listByChannel({ handle: channelURI }) |
407 | expect(total).to.equal(1) | 407 | expect(total).to.equal(1) |
408 | 408 | ||
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 348b408e8..dc47f8a4a 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -63,8 +63,8 @@ describe('Test video comments', function () { | |||
63 | expect(comment.videoId).to.equal(videoId) | 63 | expect(comment.videoId).to.equal(videoId) |
64 | expect(comment.id).to.equal(comment.threadId) | 64 | expect(comment.id).to.equal(comment.threadId) |
65 | expect(comment.account.name).to.equal('root') | 65 | expect(comment.account.name).to.equal('root') |
66 | expect(comment.account.host).to.equal('localhost:' + server.port) | 66 | expect(comment.account.host).to.equal(server.host) |
67 | expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root') | 67 | expect(comment.account.url).to.equal(server.url + '/accounts/root') |
68 | expect(comment.totalReplies).to.equal(0) | 68 | expect(comment.totalReplies).to.equal(0) |
69 | expect(comment.totalRepliesFromVideoAuthor).to.equal(0) | 69 | expect(comment.totalRepliesFromVideoAuthor).to.equal(0) |
70 | expect(dateIsValid(comment.createdAt as string)).to.be.true | 70 | expect(dateIsValid(comment.createdAt as string)).to.be.true |
@@ -85,7 +85,7 @@ describe('Test video comments', function () { | |||
85 | expect(comment.videoId).to.equal(videoId) | 85 | expect(comment.videoId).to.equal(videoId) |
86 | expect(comment.id).to.equal(comment.threadId) | 86 | expect(comment.id).to.equal(comment.threadId) |
87 | expect(comment.account.name).to.equal('root') | 87 | expect(comment.account.name).to.equal('root') |
88 | expect(comment.account.host).to.equal('localhost:' + server.port) | 88 | expect(comment.account.host).to.equal(server.host) |
89 | 89 | ||
90 | for (const avatar of comment.account.avatars) { | 90 | for (const avatar of comment.account.avatars) { |
91 | await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') | 91 | await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') |
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index a3de73ba5..6a18cf26a 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -404,7 +404,7 @@ describe('Test video playlists', function () { | |||
404 | it('Should not list unlisted or private playlists', async function () { | 404 | it('Should not list unlisted or private playlists', async function () { |
405 | for (const server of servers) { | 405 | for (const server of servers) { |
406 | const results = [ | 406 | const results = [ |
407 | await server.playlists.listByAccount({ handle: 'root@localhost:' + servers[1].port, sort: '-createdAt' }), | 407 | await server.playlists.listByAccount({ handle: 'root@' + servers[1].host, sort: '-createdAt' }), |
408 | await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' }) | 408 | await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' }) |
409 | ] | 409 | ] |
410 | 410 | ||
@@ -701,52 +701,52 @@ describe('Test video playlists', function () { | |||
701 | const position = 2 | 701 | const position = 2 |
702 | 702 | ||
703 | { | 703 | { |
704 | await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port }) | 704 | await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host }) |
705 | await waitJobs(servers) | 705 | await waitJobs(servers) |
706 | 706 | ||
707 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) | 707 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) |
708 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 708 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
709 | 709 | ||
710 | await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port }) | 710 | await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host }) |
711 | await waitJobs(servers) | 711 | await waitJobs(servers) |
712 | 712 | ||
713 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 713 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
714 | } | 714 | } |
715 | 715 | ||
716 | { | 716 | { |
717 | await command.addToMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port }) | 717 | await command.addToMyBlocklist({ token: userTokenServer1, server: servers[1].host }) |
718 | await waitJobs(servers) | 718 | await waitJobs(servers) |
719 | 719 | ||
720 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) | 720 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) |
721 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 721 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
722 | 722 | ||
723 | await command.removeFromMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port }) | 723 | await command.removeFromMyBlocklist({ token: userTokenServer1, server: servers[1].host }) |
724 | await waitJobs(servers) | 724 | await waitJobs(servers) |
725 | 725 | ||
726 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 726 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
727 | } | 727 | } |
728 | 728 | ||
729 | { | 729 | { |
730 | await command.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) | 730 | await command.addToServerBlocklist({ account: 'root@' + servers[1].host }) |
731 | await waitJobs(servers) | 731 | await waitJobs(servers) |
732 | 732 | ||
733 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) | 733 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) |
734 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 734 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
735 | 735 | ||
736 | await command.removeFromServerBlocklist({ account: 'root@localhost:' + servers[1].port }) | 736 | await command.removeFromServerBlocklist({ account: 'root@' + servers[1].host }) |
737 | await waitJobs(servers) | 737 | await waitJobs(servers) |
738 | 738 | ||
739 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 739 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
740 | } | 740 | } |
741 | 741 | ||
742 | { | 742 | { |
743 | await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port }) | 743 | await command.addToServerBlocklist({ server: servers[1].host }) |
744 | await waitJobs(servers) | 744 | await waitJobs(servers) |
745 | 745 | ||
746 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) | 746 | await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) |
747 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 747 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |
748 | 748 | ||
749 | await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) | 749 | await command.removeFromServerBlocklist({ server: servers[1].host }) |
750 | await waitJobs(servers) | 750 | await waitJobs(servers) |
751 | 751 | ||
752 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) | 752 | await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) |