aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-12-09 11:14:47 +0100
committerChocobozzz <me@florianbigard.com>2022-12-12 13:36:23 +0100
commit2732eeff9e6994582293b5aaa0cb158b7e272e9e (patch)
tree417d30cf470cd1db84e06c5dbd1b5429d4b99bc1 /server/tests/api/check-params
parentc7c5f8d0f17b0ab598fbe237f11639c6de28110c (diff)
downloadPeerTube-2732eeff9e6994582293b5aaa0cb158b7e272e9e.tar.gz
PeerTube-2732eeff9e6994582293b5aaa0cb158b7e272e9e.tar.zst
PeerTube-2732eeff9e6994582293b5aaa0cb158b7e272e9e.zip
Fix CI using 127.0.0.1 for tests
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/blocklist.ts32
-rw-r--r--server/tests/api/check-params/contact-form.ts4
-rw-r--r--server/tests/api/check-params/follows.ts34
-rw-r--r--server/tests/api/check-params/redundancy.ts8
-rw-r--r--server/tests/api/check-params/services.ts30
-rw-r--r--server/tests/api/check-params/user-notifications.ts6
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts18
-rw-r--r--server/tests/api/check-params/users-admin.ts2
8 files changed, 67 insertions, 67 deletions
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 }