Fix CI using 127.0.0.1 for tests

This commit is contained in:
Chocobozzz 2022-12-09 11:14:47 +01:00
parent c7c5f8d0f1
commit 2732eeff9e
No known key found for this signature in database
GPG key ID: 583A612D890159BE
62 changed files with 312 additions and 322 deletions

View file

@ -2,7 +2,6 @@ listen:
port: 9001 port: 9001
webserver: webserver:
hostname: 'localhost'
port: 9001 port: 9001
database: database:

View file

@ -2,7 +2,6 @@ listen:
port: 9002 port: 9002
webserver: webserver:
hostname: 'localhost'
port: 9002 port: 9002
database: database:

View file

@ -2,7 +2,6 @@ listen:
port: 9003 port: 9003
webserver: webserver:
hostname: 'localhost'
port: 9003 port: 9003
database: database:

View file

@ -2,7 +2,6 @@ listen:
port: 9004 port: 9004
webserver: webserver:
hostname: 'localhost'
port: 9004 port: 9004
database: database:

View file

@ -2,7 +2,6 @@ listen:
port: 9005 port: 9005
webserver: webserver:
hostname: 'localhost'
port: 9005 port: 9005
database: database:

View file

@ -2,7 +2,6 @@ listen:
port: 9006 port: 9006
webserver: webserver:
hostname: 'localhost'
port: 9006 port: 9006
database: database:

View file

@ -3,6 +3,7 @@ listen:
port: 9000 port: 9000
webserver: webserver:
hostname: '127.0.0.1'
https: false https: false
secrets: secrets:
@ -20,18 +21,18 @@ rates_limit:
max: 500 max: 500
database: database:
hostname: 'localhost' hostname: '127.0.0.1'
port: 5432 port: 5432
redis: redis:
hostname: 'localhost' hostname: '127.0.0.1'
smtp: smtp:
hostname: null hostname: null
port: 1025 port: 1025
tls: false tls: false
disable_starttls: true disable_starttls: true
from_address: 'test-admin@localhost' from_address: 'test-admin@127.0.0.1'
username: null username: null
password: null password: null

View file

@ -18,11 +18,11 @@ removeFiles () {
dropRedis () { dropRedis () {
port=$((9000+$1)) port=$((9000+$1))
host="localhost" host="127.0.0.1"
redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL redis-cli -h "$host" KEYS "bull-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL redis-cli -h "$host" KEYS "redis-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL redis-cli -h "$host" KEYS "*redis-127.0.0.1:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL
} }
seq=$(seq 1 6) seq=$(seq 1 6)

View file

@ -23,7 +23,7 @@ describe('Test activitypub', function () {
const object = res.body const object = res.body
expect(object.type).to.equal('Person') expect(object.type).to.equal('Person')
expect(object.id).to.equal('http://localhost:' + servers[0].port + '/accounts/root') expect(object.id).to.equal(servers[0].url + '/accounts/root')
expect(object.name).to.equal('root') expect(object.name).to.equal('root')
expect(object.preferredUsername).to.equal('root') expect(object.preferredUsername).to.equal('root')
} }
@ -33,7 +33,7 @@ describe('Test activitypub', function () {
const object = res.body const object = res.body
expect(object.type).to.equal('Group') expect(object.type).to.equal('Group')
expect(object.id).to.equal('http://localhost:' + servers[0].port + '/video-channels/root_channel') expect(object.id).to.equal(servers[0].url + '/video-channels/root_channel')
expect(object.name).to.equal('Main root channel') expect(object.name).to.equal('Main root channel')
expect(object.preferredUsername).to.equal('root_channel') expect(object.preferredUsername).to.equal('root_channel')
} }
@ -43,7 +43,7 @@ describe('Test activitypub', function () {
const object = res.body const object = res.body
expect(object.type).to.equal('Video') expect(object.type).to.equal('Video')
expect(object.id).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid) expect(object.id).to.equal(servers[0].url + '/videos/watch/' + video.uuid)
expect(object.name).to.equal('video') expect(object.name).to.equal('video')
} }
@ -52,7 +52,7 @@ describe('Test activitypub', function () {
const object = res.body const object = res.body
expect(object.type).to.equal('Playlist') expect(object.type).to.equal('Playlist')
expect(object.id).to.equal('http://localhost:' + servers[0].port + '/video-playlists/' + playlist.uuid) expect(object.id).to.equal(servers[0].url + '/video-playlists/' + playlist.uuid)
expect(object.name).to.equal('playlist') expect(object.name).to.equal('playlist')
} }
@ -110,7 +110,7 @@ describe('Test activitypub', function () {
it('Should redirect to the origin video object', async function () { it('Should redirect to the origin video object', async function () {
const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + video.uuid, HttpStatusCode.FOUND_302) const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + video.uuid, HttpStatusCode.FOUND_302)
expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid) expect(res.header.location).to.equal(servers[0].url + '/videos/watch/' + video.uuid)
}) })
it('Should return the watch action', async function () { it('Should return the watch action', async function () {

View file

@ -35,13 +35,13 @@ describe('Test ActivityPub fetcher', function () {
await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'video user' } }) await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'video user' } })
{ {
const to = 'http://localhost:' + servers[0].port + '/accounts/user1' const to = servers[0].url + '/accounts/user1'
const value = 'http://localhost:' + servers[1].port + '/accounts/user1' const value = servers[1].url + '/accounts/user1'
await servers[0].sql.setActorField(to, 'url', value) await servers[0].sql.setActorField(to, 'url', value)
} }
{ {
const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + uuid const value = servers[2].url + '/videos/watch/' + uuid
await servers[0].sql.setVideoField(uuid, 'url', value) await servers[0].sql.setVideoField(uuid, 'url', value)
} }
}) })

View file

@ -112,16 +112,16 @@ describe('Test AP refresher', function () {
await wait(10000) await wait(10000)
// Change actor name so the remote server returns a 404 // Change actor name so the remote server returns a 404
const to = 'http://localhost:' + servers[1].port + '/accounts/user2' const to = servers[1].url + '/accounts/user2'
await servers[1].sql.setActorField(to, 'preferredUsername', 'toto') await servers[1].sql.setActorField(to, 'preferredUsername', 'toto')
await command.get({ accountName: 'user1@localhost:' + servers[1].port }) await command.get({ accountName: 'user1@' + servers[1].host })
await command.get({ accountName: 'user2@localhost:' + servers[1].port }) await command.get({ accountName: 'user2@' + servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await command.get({ accountName: 'user1@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.OK_200 }) await command.get({ accountName: 'user1@' + servers[1].host, expectedStatus: HttpStatusCode.OK_200 })
await command.get({ accountName: 'user2@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) await command.get({ accountName: 'user2@' + servers[1].host, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
}) })
}) })

View file

@ -11,7 +11,7 @@ import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands' import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands'
function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) { function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) {
const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' const url = ofServer.url + '/accounts/peertube'
return Promise.all([ return Promise.all([
onServer.sql.setActorField(url, 'publicKey', publicKey), onServer.sql.setActorField(url, 'publicKey', publicKey),
@ -20,7 +20,7 @@ function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, pu
} }
function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) { function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) {
const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' const url = ofServer.url + '/accounts/peertube'
return Promise.all([ return Promise.all([
onServer.sql.setActorField(url, 'createdAt', updatedAt), onServer.sql.setActorField(url, 'createdAt', updatedAt),
@ -52,7 +52,7 @@ describe('Test ActivityPub security', function () {
const baseHttpSignature = () => ({ const baseHttpSignature = () => ({
algorithm: HTTP_SIGNATURE.ALGORITHM, algorithm: HTTP_SIGNATURE.ALGORITHM,
authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,
keyId: 'acct:peertube@localhost:' + servers[1].port, keyId: 'acct:peertube@' + servers[1].host,
key: keys.privateKey, key: keys.privateKey,
headers: HTTP_SIGNATURE.HEADERS_TO_SIGN headers: HTTP_SIGNATURE.HEADERS_TO_SIGN
}) })
@ -69,8 +69,8 @@ describe('Test ActivityPub security', function () {
await setKeysOfServer(servers[0], servers[1], keys.publicKey, null) await setKeysOfServer(servers[0], servers[1], keys.publicKey, null)
await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey) await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey)
const to = { url: 'http://localhost:' + servers[0].port + '/accounts/peertube' } const to = { url: servers[0].url + '/accounts/peertube' }
const by = { url: 'http://localhost:' + servers[1].port + '/accounts/peertube', privateKey: keys.privateKey } const by = { url: servers[1].url + '/accounts/peertube', privateKey: keys.privateKey }
await makeFollowRequest(to, by) await makeFollowRequest(to, by)
}) })
@ -196,8 +196,8 @@ describe('Test ActivityPub security', function () {
await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey) await setKeysOfServer(servers[1], servers[1], keys.publicKey, keys.privateKey)
await setKeysOfServer(servers[2], servers[2], keys.publicKey, keys.privateKey) await setKeysOfServer(servers[2], servers[2], keys.publicKey, keys.privateKey)
const to = { url: 'http://localhost:' + servers[0].port + '/accounts/peertube' } const to = { url: servers[0].url + '/accounts/peertube' }
const by = { url: 'http://localhost:' + servers[2].port + '/accounts/peertube', privateKey: keys.privateKey } const by = { url: servers[2].url + '/accounts/peertube', privateKey: keys.privateKey }
await makeFollowRequest(to, by) await makeFollowRequest(to, by)
}) })
@ -208,9 +208,9 @@ describe('Test ActivityPub security', function () {
await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey) await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey)
const body = getAnnounceWithoutContext(servers[1]) const body = getAnnounceWithoutContext(servers[1])
body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' body.actor = servers[2].url + '/accounts/peertube'
const signer: any = { privateKey: invalidKeys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } const signer: any = { privateKey: invalidKeys.privateKey, url: servers[2].url + '/accounts/peertube' }
const signedBody = await signAndContextify(signer, body, 'Announce') const signedBody = await signAndContextify(signer, body, 'Announce')
const headers = buildGlobalHeaders(signedBody) const headers = buildGlobalHeaders(signedBody)
@ -230,12 +230,12 @@ describe('Test ActivityPub security', function () {
await setKeysOfServer(servers[0], servers[2], keys.publicKey, keys.privateKey) await setKeysOfServer(servers[0], servers[2], keys.publicKey, keys.privateKey)
const body = getAnnounceWithoutContext(servers[1]) const body = getAnnounceWithoutContext(servers[1])
body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' body.actor = servers[2].url + '/accounts/peertube'
const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }
const signedBody = await signAndContextify(signer, body, 'Announce') const signedBody = await signAndContextify(signer, body, 'Announce')
signedBody.actor = 'http://localhost:' + servers[2].port + '/account/peertube' signedBody.actor = servers[2].url + '/account/peertube'
const headers = buildGlobalHeaders(signedBody) const headers = buildGlobalHeaders(signedBody)
@ -251,9 +251,9 @@ describe('Test ActivityPub security', function () {
this.timeout(10000) this.timeout(10000)
const body = getAnnounceWithoutContext(servers[1]) const body = getAnnounceWithoutContext(servers[1])
body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' body.actor = servers[2].url + '/accounts/peertube'
const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }
const signedBody = await signAndContextify(signer, body, 'Announce') const signedBody = await signAndContextify(signer, body, 'Announce')
const headers = buildGlobalHeaders(signedBody) const headers = buildGlobalHeaders(signedBody)
@ -273,9 +273,9 @@ describe('Test ActivityPub security', function () {
await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey) await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey)
const body = getAnnounceWithoutContext(servers[1]) const body = getAnnounceWithoutContext(servers[1])
body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube' body.actor = servers[2].url + '/accounts/peertube'
const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' } const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }
const signedBody = await signAndContextify(signer, body, 'Announce') const signedBody = await signAndContextify(signer, body, 'Announce')
const headers = buildGlobalHeaders(signedBody) const headers = buildGlobalHeaders(signedBody)

View file

@ -163,7 +163,7 @@ describe('Test blocklist API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { host: 'localhost:9002' }, fields: { host: '127.0.0.1:9002' },
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -173,7 +173,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: server.accessToken, token: server.accessToken,
path, path,
fields: { host: 'localhost:9003' }, fields: { host: '127.0.0.1:9003' },
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })
}) })
@ -183,7 +183,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: server.accessToken, token: server.accessToken,
path, path,
fields: { host: 'localhost:' + server.port }, fields: { host: server.host },
expectedStatus: HttpStatusCode.CONFLICT_409 expectedStatus: HttpStatusCode.CONFLICT_409
}) })
}) })
@ -193,7 +193,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: server.accessToken, token: server.accessToken,
path, path,
fields: { host: 'localhost:' + servers[1].port }, fields: { host: servers[1].host },
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })
}) })
@ -203,7 +203,7 @@ describe('Test blocklist API validators', function () {
it('Should fail with an unauthenticated user', async function () { it('Should fail with an unauthenticated user', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -211,7 +211,7 @@ describe('Test blocklist API validators', function () {
it('Should fail with an unknown server block', async function () { it('Should fail with an unknown server block', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:9004', path: path + '/127.0.0.1:9004',
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -220,7 +220,7 @@ describe('Test blocklist API validators', function () {
it('Should succeed with the correct params', async function () { it('Should succeed with the correct params', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })
@ -393,7 +393,7 @@ describe('Test blocklist API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { host: 'localhost:' + servers[1].port }, fields: { host: servers[1].host },
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -403,7 +403,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: userAccessToken, token: userAccessToken,
path, path,
fields: { host: 'localhost:' + servers[1].port }, fields: { host: servers[1].host },
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })
}) })
@ -413,7 +413,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: server.accessToken, token: server.accessToken,
path, path,
fields: { host: 'localhost:9003' }, fields: { host: '127.0.0.1:9003' },
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })
}) })
@ -423,7 +423,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: server.accessToken, token: server.accessToken,
path, path,
fields: { host: 'localhost:' + server.port }, fields: { host: server.host },
expectedStatus: HttpStatusCode.CONFLICT_409 expectedStatus: HttpStatusCode.CONFLICT_409
}) })
}) })
@ -433,7 +433,7 @@ describe('Test blocklist API validators', function () {
url: server.url, url: server.url,
token: server.accessToken, token: server.accessToken,
path, path,
fields: { host: 'localhost:' + servers[1].port }, fields: { host: servers[1].host },
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })
}) })
@ -443,7 +443,7 @@ describe('Test blocklist API validators', function () {
it('Should fail with an unauthenticated user', async function () { it('Should fail with an unauthenticated user', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -451,7 +451,7 @@ describe('Test blocklist API validators', function () {
it('Should fail with a user without the appropriate rights', async function () { it('Should fail with a user without the appropriate rights', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })
@ -460,7 +460,7 @@ describe('Test blocklist API validators', function () {
it('Should fail with an unknown server block', async function () { it('Should fail with an unknown server block', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:9004', path: path + '/127.0.0.1:9004',
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -469,7 +469,7 @@ describe('Test blocklist API validators', function () {
it('Should succeed with the correct params', async function () { it('Should succeed with the correct params', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })

View file

@ -38,7 +38,7 @@ describe('Test contact form API validators', function () {
await killallServers([ server ]) await killallServers([ server ])
// Contact form is disabled // Contact form is disabled
await server.run({ smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } }) await server.run({ smtp: { hostname: '127.0.0.1', port: emailPort }, contact_form: { enabled: false } })
await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 }) await command.send({ ...defaultBody, expectedStatus: HttpStatusCode.CONFLICT_409 })
}) })
@ -48,7 +48,7 @@ describe('Test contact form API validators', function () {
await killallServers([ server ]) await killallServers([ server ])
// Email & contact form enabled // Email & contact form enabled
await server.run({ smtp: { hostname: 'localhost', port: emailPort } }) await server.run({ smtp: { hostname: '127.0.0.1', port: emailPort } })
await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) await command.send({ ...defaultBody, fromEmail: 'badEmail', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) await command.send({ ...defaultBody, fromEmail: 'badEmail@', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })

View file

@ -48,7 +48,7 @@ describe('Test server follows API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { hosts: [ 'localhost:9002', 'localhost:coucou' ] }, fields: { hosts: [ '127.0.0.1:9002', '127.0.0.1:coucou' ] },
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.BAD_REQUEST_400 expectedStatus: HttpStatusCode.BAD_REQUEST_400
}) })
@ -58,7 +58,7 @@ describe('Test server follows API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { hosts: [ 'localhost:9002', 'http://localhost:9003' ] }, fields: { hosts: [ '127.0.0.1:9002', 'http://127.0.0.1:9003' ] },
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.BAD_REQUEST_400 expectedStatus: HttpStatusCode.BAD_REQUEST_400
}) })
@ -68,7 +68,7 @@ describe('Test server follows API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { urls: [ 'localhost:9002', 'localhost:9002' ] }, fields: { urls: [ '127.0.0.1:9002', '127.0.0.1:9002' ] },
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.BAD_REQUEST_400 expectedStatus: HttpStatusCode.BAD_REQUEST_400
}) })
@ -78,7 +78,7 @@ describe('Test server follows API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { handles: [ 'hello@example.com', 'localhost:9001' ] }, fields: { handles: [ 'hello@example.com', '127.0.0.1:9001' ] },
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.BAD_REQUEST_400 expectedStatus: HttpStatusCode.BAD_REQUEST_400
}) })
@ -98,7 +98,7 @@ describe('Test server follows API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { hosts: [ 'localhost:9002' ] }, fields: { hosts: [ '127.0.0.1:9002' ] },
token: 'fake_token', token: 'fake_token',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
@ -108,7 +108,7 @@ describe('Test server follows API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { hosts: [ 'localhost:9002' ] }, fields: { hosts: [ '127.0.0.1:9002' ] },
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })
@ -217,7 +217,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an invalid token', async function () { it('Should fail with an invalid token', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9002', path: path + '/toto@127.0.0.1:9002',
token: 'fake_token', token: 'fake_token',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
@ -226,7 +226,7 @@ describe('Test server follows API validators', function () {
it('Should fail if the user is not an administrator', async function () { it('Should fail if the user is not an administrator', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9002', path: path + '/toto@127.0.0.1:9002',
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })
@ -244,7 +244,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an unknown follower', async function () { it('Should fail with an unknown follower', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9003', path: path + '/toto@127.0.0.1:9003',
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -257,7 +257,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an invalid token', async function () { it('Should fail with an invalid token', async function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9002/accept', path: path + '/toto@127.0.0.1:9002/accept',
token: 'fake_token', token: 'fake_token',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
@ -266,7 +266,7 @@ describe('Test server follows API validators', function () {
it('Should fail if the user is not an administrator', async function () { it('Should fail if the user is not an administrator', async function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9002/accept', path: path + '/toto@127.0.0.1:9002/accept',
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })
@ -284,7 +284,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an unknown follower', async function () { it('Should fail with an unknown follower', async function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9003/accept', path: path + '/toto@127.0.0.1:9003/accept',
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -297,7 +297,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an invalid token', async function () { it('Should fail with an invalid token', async function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9002/reject', path: path + '/toto@127.0.0.1:9002/reject',
token: 'fake_token', token: 'fake_token',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
@ -306,7 +306,7 @@ describe('Test server follows API validators', function () {
it('Should fail if the user is not an administrator', async function () { it('Should fail if the user is not an administrator', async function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9002/reject', path: path + '/toto@127.0.0.1:9002/reject',
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })
@ -324,7 +324,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an unknown follower', async function () { it('Should fail with an unknown follower', async function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path: path + '/toto@localhost:9003/reject', path: path + '/toto@127.0.0.1:9003/reject',
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -337,7 +337,7 @@ describe('Test server follows API validators', function () {
it('Should fail with an invalid token', async function () { it('Should fail with an invalid token', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:9002', path: path + '/127.0.0.1:9002',
token: 'fake_token', token: 'fake_token',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
@ -346,7 +346,7 @@ describe('Test server follows API validators', function () {
it('Should fail if the user is not an administrator', async function () { it('Should fail if the user is not an administrator', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/localhost:9002', path: path + '/127.0.0.1:9002',
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
}) })

View file

@ -186,7 +186,7 @@ describe('Test server redundancy API validators', function () {
it('Should fail with an invalid token', async function () { it('Should fail with an invalid token', async function () {
await makePutBodyRequest({ await makePutBodyRequest({
url: servers[0].url, url: servers[0].url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
fields: { redundancyAllowed: true }, fields: { redundancyAllowed: true },
token: 'fake_token', token: 'fake_token',
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
@ -196,7 +196,7 @@ describe('Test server redundancy API validators', function () {
it('Should fail if the user is not an administrator', async function () { it('Should fail if the user is not an administrator', async function () {
await makePutBodyRequest({ await makePutBodyRequest({
url: servers[0].url, url: servers[0].url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
fields: { redundancyAllowed: true }, fields: { redundancyAllowed: true },
token: userAccessToken, token: userAccessToken,
expectedStatus: HttpStatusCode.FORBIDDEN_403 expectedStatus: HttpStatusCode.FORBIDDEN_403
@ -216,7 +216,7 @@ describe('Test server redundancy API validators', function () {
it('Should fail without de redundancyAllowed param', async function () { it('Should fail without de redundancyAllowed param', async function () {
await makePutBodyRequest({ await makePutBodyRequest({
url: servers[0].url, url: servers[0].url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
fields: { blabla: true }, fields: { blabla: true },
token: servers[0].accessToken, token: servers[0].accessToken,
expectedStatus: HttpStatusCode.BAD_REQUEST_400 expectedStatus: HttpStatusCode.BAD_REQUEST_400
@ -226,7 +226,7 @@ describe('Test server redundancy API validators', function () {
it('Should succeed with the correct parameters', async function () { it('Should succeed with the correct parameters', async function () {
await makePutBodyRequest({ await makePutBodyRequest({
url: servers[0].url, url: servers[0].url,
path: path + '/localhost:' + servers[1].port, path: path + '/' + servers[1].host,
fields: { redundancyAllowed: true }, fields: { redundancyAllowed: true },
token: servers[0].accessToken, token: servers[0].accessToken,
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204

View file

@ -76,87 +76,87 @@ describe('Test services API validators', function () {
}) })
it('Should fail with an invalid element id', async function () { it('Should fail with an invalid element id', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/blabla` const embedUrl = `${server.url}/videos/watch/blabla`
await checkParamEmbed(server, embedUrl) await checkParamEmbed(server, embedUrl)
}) })
it('Should fail with an unknown element', async function () { it('Should fail with an unknown element', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c` const embedUrl = `${server.url}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c`
await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_FOUND_404) await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_FOUND_404)
}) })
it('Should fail with an invalid path', async function () { it('Should fail with an invalid path', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watchs/${server.store.videoCreated.uuid}` const embedUrl = `${server.url}/videos/watchs/${server.store.videoCreated.uuid}`
await checkParamEmbed(server, embedUrl) await checkParamEmbed(server, embedUrl)
}) })
it('Should fail with an invalid max height', async function () { it('Should fail with an invalid max height', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' }) await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' })
}) })
it('Should fail with an invalid max width', async function () { it('Should fail with an invalid max width', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' }) await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' })
}) })
it('Should fail with an invalid format', async function () { it('Should fail with an invalid format', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' }) await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' })
}) })
it('Should fail with a non supported format', async function () { it('Should fail with a non supported format', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' }) await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' })
}) })
it('Should fail with a private video', async function () { it('Should fail with a private video', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${privateVideo.uuid}` const embedUrl = `${server.url}/videos/watch/${privateVideo.uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)
}) })
it('Should fail with an unlisted video with the int id', async function () { it('Should fail with an unlisted video with the int id', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${unlistedVideo.id}` const embedUrl = `${server.url}/videos/watch/${unlistedVideo.id}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)
}) })
it('Should succeed with an unlisted video using the uuid id', async function () { it('Should succeed with an unlisted video using the uuid id', async function () {
for (const uuid of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) { for (const uuid of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) {
const embedUrl = `http://localhost:${server.port}/videos/watch/${uuid}` const embedUrl = `${server.url}/videos/watch/${uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200) await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200)
} }
}) })
it('Should fail with a private playlist', async function () { it('Should fail with a private playlist', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${privatePlaylist.uuid}` const embedUrl = `${server.url}/videos/watch/playlist/${privatePlaylist.uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)
}) })
it('Should fail with an unlisted playlist using the int id', async function () { it('Should fail with an unlisted playlist using the int id', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${unlistedPlaylist.id}` const embedUrl = `${server.url}/videos/watch/playlist/${unlistedPlaylist.id}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403) await checkParamEmbed(server, embedUrl, HttpStatusCode.FORBIDDEN_403)
}) })
it('Should succeed with an unlisted playlist using the uuid id', async function () { it('Should succeed with an unlisted playlist using the uuid id', async function () {
for (const uuid of [ unlistedPlaylist.uuid, unlistedPlaylist.shortUUID ]) { for (const uuid of [ unlistedPlaylist.uuid, unlistedPlaylist.shortUUID ]) {
const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${uuid}` const embedUrl = `${server.url}/videos/watch/playlist/${uuid}`
await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200) await checkParamEmbed(server, embedUrl, HttpStatusCode.OK_200)
} }
}) })
it('Should succeed with the correct params with a video', async function () { it('Should succeed with the correct params with a video', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}` const embedUrl = `${server.url}/videos/watch/${server.store.videoCreated.uuid}`
const query = { const query = {
format: 'json', format: 'json',
maxheight: 400, maxheight: 400,
@ -167,7 +167,7 @@ describe('Test services API validators', function () {
}) })
it('Should succeed with the correct params with a playlist', async function () { it('Should succeed with the correct params with a playlist', async function () {
const embedUrl = `http://localhost:${server.port}/videos/watch/playlist/${playlistUUID}` const embedUrl = `${server.url}/videos/watch/playlist/${playlistUUID}`
const query = { const query = {
format: 'json', format: 'json',
maxheight: 400, maxheight: 400,

View file

@ -233,7 +233,7 @@ describe('Test user notifications API validators', function () {
describe('When connecting to my notification socket', function () { describe('When connecting to my notification socket', function () {
it('Should fail with no token', function (next) { it('Should fail with no token', function (next) {
const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false }) const socket = io(`${server.url}/user-notifications`, { reconnection: false })
socket.once('connect_error', function () { socket.once('connect_error', function () {
socket.disconnect() socket.disconnect()
@ -247,7 +247,7 @@ describe('Test user notifications API validators', function () {
}) })
it('Should fail with an invalid token', function (next) { it('Should fail with an invalid token', function (next) {
const socket = io(`http://localhost:${server.port}/user-notifications`, { const socket = io(`${server.url}/user-notifications`, {
query: { accessToken: 'bad_access_token' }, query: { accessToken: 'bad_access_token' },
reconnection: false reconnection: false
}) })
@ -264,7 +264,7 @@ describe('Test user notifications API validators', function () {
}) })
it('Should success with the correct token', function (next) { it('Should success with the correct token', function (next) {
const socket = io(`http://localhost:${server.port}/user-notifications`, { const socket = io(`${server.url}/user-notifications`, {
query: { accessToken: server.accessToken }, query: { accessToken: server.accessToken },
reconnection: false reconnection: false
}) })

View file

@ -104,7 +104,7 @@ describe('Test user subscriptions API validators', function () {
await makePostBodyRequest({ await makePostBodyRequest({
url: server.url, url: server.url,
path, path,
fields: { uri: 'user1_channel@localhost:' + server.port }, fields: { uri: 'user1_channel@' + server.host },
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -142,7 +142,7 @@ describe('Test user subscriptions API validators', function () {
url: server.url, url: server.url,
path, path,
token: server.accessToken, token: server.accessToken,
fields: { uri: 'user1_channel@localhost:' + server.port }, fields: { uri: 'user1_channel@' + server.host },
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })
@ -154,7 +154,7 @@ describe('Test user subscriptions API validators', function () {
it('Should fail with a non authenticated user', async function () { it('Should fail with a non authenticated user', async function () {
await makeGetRequest({ await makeGetRequest({
url: server.url, url: server.url,
path: path + '/user1_channel@localhost:' + server.port, path: path + '/user1_channel@' + server.host,
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -185,7 +185,7 @@ describe('Test user subscriptions API validators', function () {
it('Should fail with an unknown subscription', async function () { it('Should fail with an unknown subscription', async function () {
await makeGetRequest({ await makeGetRequest({
url: server.url, url: server.url,
path: path + '/root1@localhost:' + server.port, path: path + '/root1@' + server.host,
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -194,7 +194,7 @@ describe('Test user subscriptions API validators', function () {
it('Should succeed with the correct parameters', async function () { it('Should succeed with the correct parameters', async function () {
await makeGetRequest({ await makeGetRequest({
url: server.url, url: server.url,
path: path + '/user1_channel@localhost:' + server.port, path: path + '/user1_channel@' + server.host,
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.OK_200 expectedStatus: HttpStatusCode.OK_200
}) })
@ -234,7 +234,7 @@ describe('Test user subscriptions API validators', function () {
await makeGetRequest({ await makeGetRequest({
url: server.url, url: server.url,
path: existPath, path: existPath,
query: { 'uris[]': 'coucou@localhost:' + server.port }, query: { 'uris[]': 'coucou@' + server.host },
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.OK_200 expectedStatus: HttpStatusCode.OK_200
}) })
@ -245,7 +245,7 @@ describe('Test user subscriptions API validators', function () {
it('Should fail with a non authenticated user', async function () { it('Should fail with a non authenticated user', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/user1_channel@localhost:' + server.port, path: path + '/user1_channel@' + server.host,
expectedStatus: HttpStatusCode.UNAUTHORIZED_401 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
}) })
}) })
@ -276,7 +276,7 @@ describe('Test user subscriptions API validators', function () {
it('Should fail with an unknown subscription', async function () { it('Should fail with an unknown subscription', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/root1@localhost:' + server.port, path: path + '/root1@' + server.host,
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NOT_FOUND_404 expectedStatus: HttpStatusCode.NOT_FOUND_404
}) })
@ -285,7 +285,7 @@ describe('Test user subscriptions API validators', function () {
it('Should succeed with the correct parameters', async function () { it('Should succeed with the correct parameters', async function () {
await makeDeleteRequest({ await makeDeleteRequest({
url: server.url, url: server.url,
path: path + '/user1_channel@localhost:' + server.port, path: path + '/user1_channel@' + server.host,
token: server.accessToken, token: server.accessToken,
expectedStatus: HttpStatusCode.NO_CONTENT_204 expectedStatus: HttpStatusCode.NO_CONTENT_204
}) })

View file

@ -158,7 +158,7 @@ describe('Test users admin API validators', function () {
const config = { const config = {
smtp: { smtp: {
hostname: 'localhost', hostname: '127.0.0.1',
port: emailPort port: emailPort
} }
} }

View file

@ -154,7 +154,7 @@ describe('Test blocklist', function () {
}) })
it('Should block a remote account', async function () { it('Should block a remote account', async function () {
await command.addToMyBlocklist({ account: 'user2@localhost:' + servers[1].port }) await command.addToMyBlocklist({ account: 'user2@' + servers[1].host })
}) })
it('Should hide its videos', async function () { it('Should hide its videos', async function () {
@ -217,7 +217,7 @@ describe('Test blocklist', function () {
server: servers[0], server: servers[0],
token: userToken1, token: userToken1,
videoUUID: videoUUID2, videoUUID: videoUUID2,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'absence') await checkCommentNotification(servers[0], comment, 'absence')
} }
@ -237,7 +237,7 @@ describe('Test blocklist', function () {
expect(block.byAccount.name).to.equal('root') expect(block.byAccount.name).to.equal('root')
expect(block.blockedAccount.displayName).to.equal('user2') expect(block.blockedAccount.displayName).to.equal('user2')
expect(block.blockedAccount.name).to.equal('user2') expect(block.blockedAccount.name).to.equal('user2')
expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port) expect(block.blockedAccount.host).to.equal('' + servers[1].host)
} }
{ {
@ -249,7 +249,7 @@ describe('Test blocklist', function () {
expect(block.byAccount.name).to.equal('root') expect(block.byAccount.name).to.equal('root')
expect(block.blockedAccount.displayName).to.equal('user1') expect(block.blockedAccount.displayName).to.equal('user1')
expect(block.blockedAccount.name).to.equal('user1') expect(block.blockedAccount.name).to.equal('user1')
expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port) expect(block.blockedAccount.host).to.equal('' + servers[0].host)
} }
}) })
@ -347,7 +347,7 @@ describe('Test blocklist', function () {
}) })
it('Should unblock the remote account', async function () { it('Should unblock the remote account', async function () {
await command.removeFromMyBlocklist({ account: 'user2@localhost:' + servers[1].port }) await command.removeFromMyBlocklist({ account: 'user2@' + servers[1].host })
}) })
it('Should display its videos', async function () { it('Should display its videos', async function () {
@ -401,7 +401,7 @@ describe('Test blocklist', function () {
server: servers[0], server: servers[0],
token: userToken1, token: userToken1,
videoUUID: videoUUID2, videoUUID: videoUUID2,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'presence') await checkCommentNotification(servers[0], comment, 'presence')
} }
@ -419,7 +419,7 @@ describe('Test blocklist', function () {
}) })
it('Should block a remote server', async function () { it('Should block a remote server', async function () {
await command.addToMyBlocklist({ server: 'localhost:' + servers[1].port }) await command.addToMyBlocklist({ server: '' + servers[1].host })
}) })
it('Should hide its videos', async function () { it('Should hide its videos', async function () {
@ -463,7 +463,7 @@ describe('Test blocklist', function () {
server: servers[1], server: servers[1],
token: userToken2, token: userToken2,
videoUUID: videoUUID1, videoUUID: videoUUID1,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'absence') await checkCommentNotification(servers[0], comment, 'absence')
} }
@ -476,7 +476,7 @@ describe('Test blocklist', function () {
const block = body.data[0] const block = body.data[0]
expect(block.byAccount.displayName).to.equal('root') expect(block.byAccount.displayName).to.equal('root')
expect(block.byAccount.name).to.equal('root') expect(block.byAccount.name).to.equal('root')
expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port) expect(block.blockedServer.host).to.equal('' + servers[1].host)
}) })
it('Should search blocked servers', async function () { it('Should search blocked servers', async function () {
@ -516,7 +516,7 @@ describe('Test blocklist', function () {
}) })
it('Should unblock the remote server', async function () { it('Should unblock the remote server', async function () {
await command.removeFromMyBlocklist({ server: 'localhost:' + servers[1].port }) await command.removeFromMyBlocklist({ server: '' + servers[1].host })
}) })
it('Should display its videos', function () { it('Should display its videos', function () {
@ -540,7 +540,7 @@ describe('Test blocklist', function () {
server: servers[1], server: servers[1],
token: userToken2, token: userToken2,
videoUUID: videoUUID1, videoUUID: videoUUID1,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'presence') await checkCommentNotification(servers[0], comment, 'presence')
} }
@ -564,7 +564,7 @@ describe('Test blocklist', function () {
}) })
it('Should block a remote account', async function () { it('Should block a remote account', async function () {
await command.addToServerBlocklist({ account: 'user2@localhost:' + servers[1].port }) await command.addToServerBlocklist({ account: 'user2@' + servers[1].host })
}) })
it('Should hide its videos', async function () { it('Should hide its videos', async function () {
@ -624,7 +624,7 @@ describe('Test blocklist', function () {
server: servers[1], server: servers[1],
token: userToken2, token: userToken2,
videoUUID: videoUUID1, videoUUID: videoUUID1,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'absence') await checkCommentNotification(servers[0], comment, 'absence')
} }
@ -640,7 +640,7 @@ describe('Test blocklist', function () {
expect(block.byAccount.name).to.equal('peertube') expect(block.byAccount.name).to.equal('peertube')
expect(block.blockedAccount.displayName).to.equal('user2') expect(block.blockedAccount.displayName).to.equal('user2')
expect(block.blockedAccount.name).to.equal('user2') expect(block.blockedAccount.name).to.equal('user2')
expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port) expect(block.blockedAccount.host).to.equal('' + servers[1].host)
} }
{ {
@ -652,7 +652,7 @@ describe('Test blocklist', function () {
expect(block.byAccount.name).to.equal('peertube') expect(block.byAccount.name).to.equal('peertube')
expect(block.blockedAccount.displayName).to.equal('user1') expect(block.blockedAccount.displayName).to.equal('user1')
expect(block.blockedAccount.name).to.equal('user1') expect(block.blockedAccount.name).to.equal('user1')
expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port) expect(block.blockedAccount.host).to.equal('' + servers[0].host)
} }
}) })
@ -685,7 +685,7 @@ describe('Test blocklist', function () {
}) })
it('Should unblock the remote account', async function () { it('Should unblock the remote account', async function () {
await command.removeFromServerBlocklist({ account: 'user2@localhost:' + servers[1].port }) await command.removeFromServerBlocklist({ account: 'user2@' + servers[1].host })
}) })
it('Should display its videos', async function () { it('Should display its videos', async function () {
@ -721,7 +721,7 @@ describe('Test blocklist', function () {
server: servers[1], server: servers[1],
token: userToken2, token: userToken2,
videoUUID: videoUUID1, videoUUID: videoUUID1,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'presence') await checkCommentNotification(servers[0], comment, 'presence')
} }
@ -743,7 +743,7 @@ describe('Test blocklist', function () {
}) })
it('Should block a remote server', async function () { it('Should block a remote server', async function () {
await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port }) await command.addToServerBlocklist({ server: '' + servers[1].host })
}) })
it('Should hide its videos', async function () { it('Should hide its videos', async function () {
@ -791,7 +791,7 @@ describe('Test blocklist', function () {
server: servers[1], server: servers[1],
token: userToken2, token: userToken2,
videoUUID: videoUUID1, videoUUID: videoUUID1,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'absence') await checkCommentNotification(servers[0], comment, 'absence')
} }
@ -820,7 +820,7 @@ describe('Test blocklist', function () {
const block = body.data[0] const block = body.data[0]
expect(block.byAccount.displayName).to.equal('peertube') expect(block.byAccount.displayName).to.equal('peertube')
expect(block.byAccount.name).to.equal('peertube') expect(block.byAccount.name).to.equal('peertube')
expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port) expect(block.blockedServer.host).to.equal('' + servers[1].host)
}) })
it('Should search blocked servers', async function () { it('Should search blocked servers', async function () {
@ -848,7 +848,7 @@ describe('Test blocklist', function () {
}) })
it('Should unblock the remote server', async function () { it('Should unblock the remote server', async function () {
await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) await command.removeFromServerBlocklist({ server: '' + servers[1].host })
}) })
it('Should list all videos', async function () { it('Should list all videos', async function () {
@ -876,7 +876,7 @@ describe('Test blocklist', function () {
server: servers[1], server: servers[1],
token: userToken2, token: userToken2,
videoUUID: videoUUID1, videoUUID: videoUUID1,
text: 'hello @root@localhost:' + servers[0].port text: 'hello @root@' + servers[0].host
} }
await checkCommentNotification(servers[0], comment, 'presence') await checkCommentNotification(servers[0], comment, 'presence')
} }

View file

@ -31,7 +31,7 @@ describe('Test admin notifications', function () {
peertube: { peertube: {
check_latest_version: { check_latest_version: {
enabled: true, enabled: true,
url: `http://localhost:${port}/versions.json` url: `http://127.0.0.1:${port}/versions.json`
} }
}, },
plugins: { plugins: {

View file

@ -257,7 +257,7 @@ describe('Test comments notifications', function () {
await waitJobs(servers) await waitJobs(servers)
const text1 = `hello @user_1@localhost:${servers[0].port} 1` const text1 = `hello @user_1@${servers[0].host} 1`
const { id: server2ThreadId } = await servers[1].comments.createThread({ videoId: uuid, text: text1 }) const { id: server2ThreadId } = await servers[1].comments.createThread({ videoId: uuid, text: text1 })
await waitJobs(servers) await waitJobs(servers)
@ -269,7 +269,7 @@ describe('Test comments notifications', function () {
const threadId = data[0].id const threadId = data[0].id
await checkCommentMention({ ...baseParams, shortUUID, commentId: threadId, threadId, byAccountDisplayName, checkType: 'presence' }) await checkCommentMention({ ...baseParams, shortUUID, commentId: threadId, threadId, byAccountDisplayName, checkType: 'presence' })
const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}` const text2 = `@user_1@${servers[0].host} hello 2 @root@${servers[0].host}`
await servers[1].comments.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 }) await servers[1].comments.addReply({ videoId: uuid, toCommentId: server2ThreadId, text: text2 })
await waitJobs(servers) await waitJobs(servers)

View file

@ -373,7 +373,7 @@ describe('Test moderation notifications', function () {
followings: { followings: {
instance: { instance: {
autoFollowIndex: { autoFollowIndex: {
indexUrl: `http://localhost:${port}/api/v1/instances/hosts`, indexUrl: `http://127.0.0.1:${port}/api/v1/instances/hosts`,
enabled: true enabled: true
} }
} }
@ -388,10 +388,10 @@ describe('Test moderation notifications', function () {
await waitJobs(servers) await waitJobs(servers)
await checkNewInstanceFollower({ ...baseParams, followerHost: 'localhost:' + servers[2].port, checkType: 'presence' }) await checkNewInstanceFollower({ ...baseParams, followerHost: servers[2].host, checkType: 'presence' })
const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } } const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } }
await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: 'localhost:' + servers[2].port, checkType: 'absence' }) await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: servers[2].host, checkType: 'absence' })
}) })
it('Should send a notification on auto follow back', async function () { it('Should send a notification on auto follow back', async function () {
@ -495,8 +495,8 @@ describe('Test moderation notifications', function () {
autoBlacklistTestsCustomConfig.transcoding.enabled = true autoBlacklistTestsCustomConfig.transcoding.enabled = true
await servers[0].config.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig }) await servers[0].config.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig })
await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })
await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })
}) })
it('Should send notification to moderators on new video with auto-blacklist', async function () { it('Should send notification to moderators on new video with auto-blacklist', async function () {
@ -615,8 +615,8 @@ describe('Test moderation notifications', function () {
after(async () => { after(async () => {
await servers[0].config.updateCustomConfig({ newCustomConfig: currentCustomConfig }) await servers[0].config.updateCustomConfig({ newCustomConfig: currentCustomConfig })
await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })
await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })
}) })
}) })

View file

@ -26,7 +26,7 @@ describe('Test notifications API', function () {
userNotifications = res.userNotifications userNotifications = res.userNotifications
server = res.servers[0] server = res.servers[0]
await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port }) await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@' + server.host })
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
await server.videos.randomUpload({ wait: false }) await server.videos.randomUpload({ wait: false })

View file

@ -69,7 +69,7 @@ describe('Test user notifications', function () {
it('Should send a new video notification if the user follows the local video publisher', async function () { it('Should send a new video notification if the user follows the local video publisher', async function () {
this.timeout(15000) this.timeout(15000)
await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port }) await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[0].host })
await waitJobs(servers) await waitJobs(servers)
const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1) const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)
@ -79,7 +79,7 @@ describe('Test user notifications', function () {
it('Should send a new video notification from a remote account', async function () { it('Should send a new video notification from a remote account', async function () {
this.timeout(150000) // Server 2 has transcoding enabled this.timeout(150000) // Server 2 has transcoding enabled
await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port }) await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[1].host })
await waitJobs(servers) await waitJobs(servers)
const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2) const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2)
@ -509,7 +509,7 @@ describe('Test user notifications', function () {
it('Should notify when a local channel is following one of our channel', async function () { it('Should notify when a local channel is following one of our channel', async function () {
this.timeout(50000) this.timeout(50000)
await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) await servers[0].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })
await waitJobs(servers) await waitJobs(servers)
await checkNewActorFollow({ await checkNewActorFollow({
@ -521,13 +521,13 @@ describe('Test user notifications', function () {
checkType: 'presence' checkType: 'presence'
}) })
await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) await servers[0].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })
}) })
it('Should notify when a remote channel is following one of our channel', async function () { it('Should notify when a remote channel is following one of our channel', async function () {
this.timeout(50000) this.timeout(50000)
await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) await servers[1].subscriptions.add({ targetUri: 'user_1_channel@' + servers[0].host })
await waitJobs(servers) await waitJobs(servers)
await checkNewActorFollow({ await checkNewActorFollow({
@ -539,14 +539,14 @@ describe('Test user notifications', function () {
checkType: 'presence' checkType: 'presence'
}) })
await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) await servers[1].subscriptions.remove({ uri: 'user_1_channel@' + servers[0].host })
}) })
// PeerTube does not support account -> account follows // PeerTube does not support account -> account follows
// it('Should notify when a local account is following one of our channel', async function () { // it('Should notify when a local account is following one of our channel', async function () {
// this.timeout(50000) // this.timeout(50000)
// //
// await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port) // await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@' + servers[0].host)
// //
// await waitJobs(servers) // await waitJobs(servers)
// //
@ -556,7 +556,7 @@ describe('Test user notifications', function () {
// it('Should notify when a remote account is following one of our channel', async function () { // it('Should notify when a remote account is following one of our channel', async function () {
// this.timeout(50000) // this.timeout(50000)
// //
// await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port) // await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@' + servers[0].host)
// //
// await waitJobs(servers) // await waitJobs(servers)
// //

View file

@ -139,7 +139,7 @@ function runTestSuite (options: {
this.timeout(120000) this.timeout(120000)
const port = await mockObjectStorage.initialize() const port = await mockObjectStorage.initialize()
baseMockUrl = options.useMockBaseUrl ? `http://localhost:${port}` : undefined baseMockUrl = options.useMockBaseUrl ? `http://127.0.0.1:${port}` : undefined
await ObjectStorageCommand.createMockBucket(options.playlistBucket) await ObjectStorageCommand.createMockBucket(options.playlistBucket)
await ObjectStorageCommand.createMockBucket(options.webtorrentBucket) await ObjectStorageCommand.createMockBucket(options.webtorrentBucket)

View file

@ -265,8 +265,8 @@ async function checkStatsWithoutRedundancy (strategy: VideoRedundancyStrategyWit
async function findServerFollows () { async function findServerFollows () {
const body = await servers[0].follows.getFollowings({ start: 0, count: 5, sort: '-createdAt' }) const body = await servers[0].follows.getFollowings({ start: 0, count: 5, sort: '-createdAt' })
const follows = body.data const follows = body.data
const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`) const server2 = follows.find(f => f.following.host === `${servers[1].host}`)
const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`) const server3 = follows.find(f => f.following.host === `${servers[2].host}`)
return { server2, server3 } return { server2, server3 }
} }
@ -639,12 +639,12 @@ describe('Test videos redundancy', function () {
await wait(10000) await wait(10000)
try { try {
await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port) await checkContains(servers, 'http%3A%2F%2F' + servers[0].hostname + '%3A' + servers[0].port)
} catch { } catch {
// Maybe a server deleted a redundancy in the scheduler // Maybe a server deleted a redundancy in the scheduler
await wait(2000) await wait(2000)
await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port) await checkContains(servers, 'http%3A%2F%2F' + servers[0].hostname + '%3A' + servers[0].port)
} }
}) })
@ -655,7 +655,7 @@ describe('Test videos redundancy', function () {
await wait(15000) await wait(15000)
await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A' + servers[0].port) await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2F' + servers[0].port + '%3A' + servers[0].port)
}) })
after(async function () { after(async function () {

View file

@ -87,7 +87,7 @@ describe('Test ActivityPub video channels search', function () {
it('Should search a local video channel', async function () { it('Should search a local video channel', async function () {
const searches = [ const searches = [
servers[0].url + '/video-channels/channel1_server1', servers[0].url + '/video-channels/channel1_server1',
'channel1_server1@localhost:' + servers[0].port 'channel1_server1@' + servers[0].host
] ]
for (const search of searches) { for (const search of searches) {
@ -139,7 +139,7 @@ describe('Test ActivityPub video channels search', function () {
servers[1].url + '/video-channels/channel1_server2', servers[1].url + '/video-channels/channel1_server2',
servers[1].url + '/c/channel1_server2', servers[1].url + '/c/channel1_server2',
servers[1].url + '/c/channel1_server2/videos', servers[1].url + '/c/channel1_server2/videos',
'channel1_server2@localhost:' + servers[1].port 'channel1_server2@' + servers[1].host
] ]
for (const search of searches) { for (const search of searches) {
@ -169,7 +169,7 @@ describe('Test ActivityPub video channels search', function () {
const { total, data } = await servers[0].videos.listByChannel({ const { total, data } = await servers[0].videos.listByChannel({
token: null, token: null,
handle: 'channel1_server2@localhost:' + servers[1].port handle: 'channel1_server2@' + servers[1].host
}) })
expect(total).to.equal(0) expect(total).to.equal(0)
expect(data).to.have.lengthOf(0) expect(data).to.have.lengthOf(0)
@ -177,7 +177,7 @@ describe('Test ActivityPub video channels search', function () {
it('Should list video channel videos of server 2 with token', async function () { it('Should list video channel videos of server 2 with token', async function () {
const { total, data } = await servers[0].videos.listByChannel({ const { total, data } = await servers[0].videos.listByChannel({
handle: 'channel1_server2@localhost:' + servers[1].port handle: 'channel1_server2@' + servers[1].host
}) })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -226,7 +226,7 @@ describe('Test ActivityPub video channels search', function () {
await waitJobs(servers) await waitJobs(servers)
const handle = 'channel1_server2@localhost:' + servers[1].port const handle = 'channel1_server2@' + servers[1].host
const { total, data } = await servers[0].videos.listByChannel({ handle, sort: '-createdAt' }) const { total, data } = await servers[0].videos.listByChannel({ handle, sort: '-createdAt' })
expect(total).to.equal(2) expect(total).to.equal(2)

View file

@ -57,7 +57,7 @@ describe('Test index search', function () {
expect(body.total).to.equal(1) expect(body.total).to.equal(1)
expect(body.data[0].name).to.equal('root_channel') expect(body.data[0].name).to.equal('root_channel')
expect(body.data[0].host).to.equal('localhost:' + server.port) expect(body.data[0].host).to.equal(server.host)
}) })
it('Should make an index videos search by default', async function () { it('Should make an index videos search by default', async function () {

View file

@ -150,7 +150,7 @@ describe('Test auto follows', function () {
followings: { followings: {
instance: { instance: {
autoFollowIndex: { autoFollowIndex: {
indexUrl: `http://localhost:${port}/api/v1/instances/hosts`, indexUrl: `http://127.0.0.1:${port}/api/v1/instances/hosts`,
enabled: true enabled: true
} }
} }

View file

@ -77,7 +77,7 @@ describe('Test bulk actions', function () {
const { data } = await servers[1].comments.listThreads({ videoId: video.id }) const { data } = await servers[1].comments.listThreads({ videoId: video.id })
const comment = data.find(c => c.text === 'comment by user 3') const comment = data.find(c => c.text === 'comment by user 3')
if (video.account.host === 'localhost:' + servers[0].port) { if (video.account.host === servers[0].host) {
expect(comment).to.not.exist expect(comment).to.not.exist
} else { } else {
expect(comment).to.exist expect(comment).to.exist
@ -151,7 +151,7 @@ describe('Test bulk actions', function () {
await bulkCommand.removeCommentsOf({ await bulkCommand.removeCommentsOf({
attributes: { attributes: {
accountName: 'user3@localhost:' + servers[1].port, accountName: 'user3@' + servers[1].host,
scope: 'instance' scope: 'instance'
} }
}) })

View file

@ -25,7 +25,7 @@ describe('Test contact form', function () {
const overrideConfig = { const overrideConfig = {
smtp: { smtp: {
hostname: 'localhost', hostname: '127.0.0.1',
port port
} }
} }
@ -51,7 +51,7 @@ describe('Test contact form', function () {
const email = emails[0] const email = emails[0]
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['replyTo'][0]['address']).equal('toto@example.com') expect(email['replyTo'][0]['address']).equal('toto@example.com')
expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com')
expect(email['subject']).contains('my subject') expect(email['subject']).contains('my subject')

View file

@ -33,7 +33,7 @@ describe('Test emails', function () {
const overrideConfig = { const overrideConfig = {
smtp: { smtp: {
hostname: 'localhost', hostname: '127.0.0.1',
port: emailPort port: emailPort
} }
} }
@ -66,8 +66,6 @@ describe('Test emails', function () {
describe('When resetting user password', function () { describe('When resetting user password', function () {
it('Should ask to reset the password', async function () { it('Should ask to reset the password', async function () {
this.timeout(10000)
await server.users.askResetPassword({ email: 'user_1@example.com' }) await server.users.askResetPassword({ email: 'user_1@example.com' })
await waitJobs(server) await waitJobs(server)
@ -76,7 +74,7 @@ describe('Test emails', function () {
const email = emails[0] const email = emails[0]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('user_1@example.com') expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains('password') expect(email['subject']).contains('password')
@ -135,7 +133,7 @@ describe('Test emails', function () {
const email = emails[1] const email = emails[1]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('create_password@example.com') expect(email['to'][0]['address']).equal('create_password@example.com')
expect(email['subject']).contains('account') expect(email['subject']).contains('account')
expect(email['subject']).contains('password') expect(email['subject']).contains('password')
@ -191,7 +189,7 @@ describe('Test emails', function () {
const email = emails[2] const email = emails[2]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com')
expect(email['subject']).contains('abuse') expect(email['subject']).contains('abuse')
expect(email['text']).contains(videoShortUUID) expect(email['text']).contains(videoShortUUID)
@ -212,7 +210,7 @@ describe('Test emails', function () {
const email = emails[3] const email = emails[3]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('user_1@example.com') expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' blocked') expect(email['subject']).contains(' blocked')
expect(email['text']).contains(' blocked') expect(email['text']).contains(' blocked')
@ -230,7 +228,7 @@ describe('Test emails', function () {
const email = emails[4] const email = emails[4]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('user_1@example.com') expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' unblocked') expect(email['subject']).contains(' unblocked')
expect(email['text']).contains(' unblocked') expect(email['text']).contains(' unblocked')
@ -250,7 +248,7 @@ describe('Test emails', function () {
const email = emails[5] const email = emails[5]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('user_1@example.com') expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' blacklisted') expect(email['subject']).contains(' blacklisted')
expect(email['text']).contains('my super user video') expect(email['text']).contains('my super user video')
@ -268,7 +266,7 @@ describe('Test emails', function () {
const email = emails[6] const email = emails[6]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('user_1@example.com') expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' unblacklisted') expect(email['subject']).contains(' unblacklisted')
expect(email['text']).contains('my super user video') expect(email['text']).contains('my super user video')
@ -293,7 +291,7 @@ describe('Test emails', function () {
const email = emails[7] const email = emails[7]
expect(email['from'][0]['name']).equal('PeerTube') expect(email['from'][0]['name']).equal('PeerTube')
expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['address']).equal('test-admin@127.0.0.1')
expect(email['to'][0]['address']).equal('user_1@example.com') expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains('Verify') expect(email['subject']).contains('Verify')

View file

@ -57,21 +57,21 @@ describe('Test follow constraints', function () {
}) })
it('Should list local account videos', async function () { it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[0].port }) const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@' + servers[0].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
}) })
it('Should list remote account videos', async function () { it('Should list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[1].port }) const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@' + servers[1].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
}) })
it('Should list local channel videos', async function () { it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port const handle = 'root_channel@' + servers[0].host
const { total, data } = await servers[0].videos.listByChannel({ handle }) const { total, data } = await servers[0].videos.listByChannel({ handle })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -79,7 +79,7 @@ describe('Test follow constraints', function () {
}) })
it('Should list remote channel videos', async function () { it('Should list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port const handle = 'root_channel@' + servers[1].host
const { total, data } = await servers[0].videos.listByChannel({ handle }) const { total, data } = await servers[0].videos.listByChannel({ handle })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -97,21 +97,21 @@ describe('Test follow constraints', function () {
}) })
it('Should list local account videos', async function () { it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port }) const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[0].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
}) })
it('Should list remote account videos', async function () { it('Should list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port }) const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[1].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
}) })
it('Should list local channel videos', async function () { it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port const handle = 'root_channel@' + servers[0].host
const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -119,7 +119,7 @@ describe('Test follow constraints', function () {
}) })
it('Should list remote channel videos', async function () { it('Should list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port const handle = 'root_channel@' + servers[1].host
const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -161,7 +161,7 @@ describe('Test follow constraints', function () {
it('Should list local account videos', async function () { it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ const { total, data } = await servers[0].videos.listByAccount({
token: null, token: null,
handle: 'root@localhost:' + servers[0].port handle: 'root@' + servers[0].host
}) })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -171,7 +171,7 @@ describe('Test follow constraints', function () {
it('Should not list remote account videos', async function () { it('Should not list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ const { total, data } = await servers[0].videos.listByAccount({
token: null, token: null,
handle: 'root@localhost:' + servers[1].port handle: 'root@' + servers[1].host
}) })
expect(total).to.equal(0) expect(total).to.equal(0)
@ -179,7 +179,7 @@ describe('Test follow constraints', function () {
}) })
it('Should list local channel videos', async function () { it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port const handle = 'root_channel@' + servers[0].host
const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -187,7 +187,7 @@ describe('Test follow constraints', function () {
}) })
it('Should not list remote channel videos', async function () { it('Should not list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port const handle = 'root_channel@' + servers[1].host
const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(0) expect(total).to.equal(0)
@ -206,21 +206,21 @@ describe('Test follow constraints', function () {
}) })
it('Should list local account videos', async function () { it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port }) const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[0].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
}) })
it('Should list remote account videos', async function () { it('Should list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port }) const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@' + servers[1].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
}) })
it('Should list local channel videos', async function () { it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port const handle = 'root_channel@' + servers[0].host
const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -228,7 +228,7 @@ describe('Test follow constraints', function () {
}) })
it('Should list remote channel videos', async function () { it('Should list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port const handle = 'root_channel@' + servers[1].host
const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle }) const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1) expect(total).to.equal(1)

View file

@ -88,7 +88,7 @@ describe('Test follows', function () {
const follows = body.data const follows = body.data
expect(follows).to.be.an('array') expect(follows).to.be.an('array')
expect(follows).to.have.lengthOf(1) expect(follows).to.have.lengthOf(1)
expect(follows[0].follower.host).to.equal('localhost:' + servers[0].port) expect(follows[0].follower.host).to.equal(servers[0].host)
}) })
it('Should have 0 followers on server 1 and 2', async function () { it('Should have 0 followers on server 1 and 2', async function () {

View file

@ -62,7 +62,7 @@ describe('Test handle downs', function () {
support: 'my super support text for server 1', support: 'my super support text for server 1',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + servers[0].port host: servers[0].host
}, },
isLocal: false, isLocal: false,
duration: 10, duration: 10,
@ -151,7 +151,7 @@ describe('Test handle downs', function () {
const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' }) const body = await servers[0].follows.getFollowers({ start: 0, count: 2, sort: 'createdAt' })
expect(body.data).to.be.an('array') expect(body.data).to.be.an('array')
expect(body.data).to.have.lengthOf(1) expect(body.data).to.have.lengthOf(1)
expect(body.data[0].follower.host).to.equal('localhost:' + servers[2].port) expect(body.data[0].follower.host).to.equal(servers[2].host)
}) })
it('Should not have pending/processing jobs anymore', async function () { it('Should not have pending/processing jobs anymore', async function () {

View file

@ -9,7 +9,7 @@ describe('Open Telemetry', function () {
let server: PeerTubeServer let server: PeerTubeServer
describe('Metrics', function () { describe('Metrics', function () {
const metricsUrl = 'http://localhost:9092/metrics' const metricsUrl = 'http://127.0.0.1:9092/metrics'
it('Should not enable open telemetry metrics', async function () { it('Should not enable open telemetry metrics', async function () {
this.timeout(60000) this.timeout(60000)
@ -92,7 +92,7 @@ describe('Open Telemetry', function () {
tracing: { tracing: {
enabled: true, enabled: true,
jaeger_exporter: { jaeger_exporter: {
endpoint: 'http://localhost:' + mockPort endpoint: 'http://127.0.0.1:' + mockPort
} }
} }
} }

View file

@ -20,7 +20,7 @@ describe('Test proxy', function () {
let proxy: MockProxy let proxy: MockProxy
const goodEnv = { HTTP_PROXY: '' } const goodEnv = { HTTP_PROXY: '' }
const badEnv = { HTTP_PROXY: 'http://localhost:9000' } const badEnv = { HTTP_PROXY: 'http://127.0.0.1:9000' }
before(async function () { before(async function () {
this.timeout(120000) this.timeout(120000)
@ -30,7 +30,7 @@ describe('Test proxy', function () {
const proxyPort = await proxy.initialize() const proxyPort = await proxy.initialize()
servers = await createMultipleServers(2) servers = await createMultipleServers(2)
goodEnv.HTTP_PROXY = 'http://localhost:' + proxyPort goodEnv.HTTP_PROXY = 'http://127.0.0.1:' + proxyPort
await setAccessTokensToServers(servers) await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers) await setDefaultVideoChannel(servers)

View file

@ -63,8 +63,8 @@ describe('Test users subscriptions', function () {
it('User of server 1 should follow user of server 3 and root of server 1', async function () { it('User of server 1 should follow user of server 3 and root of server 1', async function () {
this.timeout(60000) this.timeout(60000)
await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })
await command.add({ token: users[0].accessToken, targetUri: 'root_channel@localhost:' + servers[0].port }) await command.add({ token: users[0].accessToken, targetUri: 'root_channel@' + servers[0].host })
await waitJobs(servers) await waitJobs(servers)
@ -112,20 +112,20 @@ describe('Test users subscriptions', function () {
it('Should get subscription', async function () { it('Should get subscription', async function () {
{ {
const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port }) const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })
expect(videoChannel.name).to.equal('user3_channel') expect(videoChannel.name).to.equal('user3_channel')
expect(videoChannel.host).to.equal('localhost:' + servers[2].port) expect(videoChannel.host).to.equal(servers[2].host)
expect(videoChannel.displayName).to.equal('Main user3 channel') expect(videoChannel.displayName).to.equal('Main user3 channel')
expect(videoChannel.followingCount).to.equal(0) expect(videoChannel.followingCount).to.equal(0)
expect(videoChannel.followersCount).to.equal(1) expect(videoChannel.followersCount).to.equal(1)
} }
{ {
const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port }) const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })
expect(videoChannel.name).to.equal('root_channel') expect(videoChannel.name).to.equal('root_channel')
expect(videoChannel.host).to.equal('localhost:' + servers[0].port) expect(videoChannel.host).to.equal(servers[0].host)
expect(videoChannel.displayName).to.equal('Main root channel') expect(videoChannel.displayName).to.equal('Main root channel')
expect(videoChannel.followingCount).to.equal(0) expect(videoChannel.followingCount).to.equal(0)
expect(videoChannel.followersCount).to.equal(1) expect(videoChannel.followersCount).to.equal(1)
@ -134,18 +134,18 @@ describe('Test users subscriptions', function () {
it('Should return the existing subscriptions', async function () { it('Should return the existing subscriptions', async function () {
const uris = [ const uris = [
'user3_channel@localhost:' + servers[2].port, 'user3_channel@' + servers[2].host,
'root2_channel@localhost:' + servers[0].port, 'root2_channel@' + servers[0].host,
'root_channel@localhost:' + servers[0].port, 'root_channel@' + servers[0].host,
'user3_channel@localhost:' + servers[0].port 'user3_channel@' + servers[0].host
] ]
const body = await command.exist({ token: users[0].accessToken, uris }) const body = await command.exist({ token: users[0].accessToken, uris })
expect(body['user3_channel@localhost:' + servers[2].port]).to.be.true expect(body['user3_channel@' + servers[2].host]).to.be.true
expect(body['root2_channel@localhost:' + servers[0].port]).to.be.false expect(body['root2_channel@' + servers[0].host]).to.be.false
expect(body['root_channel@localhost:' + servers[0].port]).to.be.true expect(body['root_channel@' + servers[0].host]).to.be.true
expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false expect(body['user3_channel@' + servers[0].host]).to.be.false
}) })
it('Should search among subscriptions', async function () { it('Should search among subscriptions', async function () {
@ -305,7 +305,7 @@ describe('Test users subscriptions', function () {
it('Should remove user of server 3 subscription', async function () { it('Should remove user of server 3 subscription', async function () {
this.timeout(30000) this.timeout(30000)
await command.remove({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port }) await command.remove({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })
await waitJobs(servers) await waitJobs(servers)
}) })
@ -324,7 +324,7 @@ describe('Test users subscriptions', function () {
it('Should remove the root subscription and not display the videos anymore', async function () { it('Should remove the root subscription and not display the videos anymore', async function () {
this.timeout(30000) this.timeout(30000)
await command.remove({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port }) await command.remove({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })
await waitJobs(servers) await waitJobs(servers)
@ -355,7 +355,7 @@ describe('Test users subscriptions', function () {
it('Should follow user of server 3 again', async function () { it('Should follow user of server 3 again', async function () {
this.timeout(60000) this.timeout(60000)
await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })
await waitJobs(servers) await waitJobs(servers)
@ -389,8 +389,8 @@ describe('Test users subscriptions', function () {
await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } }) await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } })
await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@' + servers[2].host })
await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@localhost:' + servers[2].port }) await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@' + servers[2].host })
await waitJobs(servers) await waitJobs(servers)
}) })

View file

@ -111,7 +111,7 @@ describe('Test users with multiple servers', function () {
for (const server of servers) { for (const server of servers) {
const body = await server.accounts.list({ sort: '-createdAt' }) const body = await server.accounts.list({ sort: '-createdAt' })
const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) const resList = body.data.find(a => a.name === 'root' && a.host === servers[0].host)
expect(resList).not.to.be.undefined expect(resList).not.to.be.undefined
const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host }) const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host })
@ -119,7 +119,7 @@ describe('Test users with multiple servers', function () {
if (!createdAt) createdAt = account.createdAt if (!createdAt) createdAt = account.createdAt
expect(account.name).to.equal('root') expect(account.name).to.equal('root')
expect(account.host).to.equal('localhost:' + servers[0].port) expect(account.host).to.equal(servers[0].host)
expect(account.displayName).to.equal('my super display name') expect(account.displayName).to.equal('my super display name')
expect(account.description).to.equal('my super description updated') expect(account.description).to.equal('my super description updated')
expect(createdAt).to.equal(account.createdAt) expect(createdAt).to.equal(account.createdAt)
@ -138,7 +138,7 @@ describe('Test users with multiple servers', function () {
it('Should list account videos', async function () { it('Should list account videos', async function () {
for (const server of servers) { for (const server of servers) {
const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port }) const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.be.an('array') expect(data).to.be.an('array')
@ -155,7 +155,7 @@ describe('Test users with multiple servers', function () {
await waitJobs(servers) await waitJobs(servers)
for (const server of servers) { for (const server of servers) {
const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port, search: 'Kami' }) const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host, search: 'Kami' })
expect(total).to.equal(1) expect(total).to.equal(1)
expect(data).to.be.an('array') expect(data).to.be.an('array')
@ -170,11 +170,11 @@ describe('Test users with multiple servers', function () {
for (const server of servers) { for (const server of servers) {
const body = await server.accounts.list({ sort: '-createdAt' }) const body = await server.accounts.list({ sort: '-createdAt' })
const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)
expect(accountDeleted).not.to.be.undefined expect(accountDeleted).not.to.be.undefined
const { data } = await server.channels.list() const { data } = await server.channels.list()
const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === servers[0].host)
expect(videoChannelDeleted).not.to.be.undefined expect(videoChannelDeleted).not.to.be.undefined
} }
@ -185,11 +185,11 @@ describe('Test users with multiple servers', function () {
for (const server of servers) { for (const server of servers) {
const body = await server.accounts.list({ sort: '-createdAt' }) const body = await server.accounts.list({ sort: '-createdAt' })
const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)
expect(accountDeleted).to.be.undefined expect(accountDeleted).to.be.undefined
const { data } = await server.channels.list() const { data } = await server.channels.list()
const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === servers[0].host)
expect(videoChannelDeleted).to.be.undefined expect(videoChannelDeleted).to.be.undefined
} }
}) })

View file

@ -28,7 +28,7 @@ describe('Test users account verification', function () {
const overrideConfig = { const overrideConfig = {
smtp: { smtp: {
hostname: 'localhost', hostname: '127.0.0.1',
port port
} }
} }

View file

@ -105,7 +105,7 @@ describe('Test multiple servers', function () {
originallyPublishedAt: '2019-02-10T13:38:14.449Z', originallyPublishedAt: '2019-02-10T13:38:14.449Z',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + servers[0].port host: servers[0].host
}, },
isLocal, isLocal,
publishedAt, publishedAt,
@ -185,7 +185,7 @@ describe('Test multiple servers', function () {
// All servers should have this video // All servers should have this video
for (const server of servers) { for (const server of servers) {
const isLocal = server.url === 'http://localhost:' + servers[1].port const isLocal = server.url === servers[1].url
const checkAttributes = { const checkAttributes = {
name: 'my super name for server 2', name: 'my super name for server 2',
category: 4, category: 4,
@ -196,7 +196,7 @@ describe('Test multiple servers', function () {
support: 'my super support text for server 2', support: 'my super support text for server 2',
account: { account: {
name: 'user1', name: 'user1',
host: 'localhost:' + servers[1].port host: servers[1].host
}, },
isLocal, isLocal,
commentsEnabled: true, commentsEnabled: true,
@ -279,7 +279,7 @@ describe('Test multiple servers', function () {
// All servers should have this video // All servers should have this video
for (const server of servers) { for (const server of servers) {
const isLocal = server.url === 'http://localhost:' + servers[2].port const isLocal = server.url === servers[2].url
const { data } = await server.videos.list() const { data } = await server.videos.list()
expect(data).to.be.an('array') expect(data).to.be.an('array')
@ -306,7 +306,7 @@ describe('Test multiple servers', function () {
support: 'my super support text for server 3', support: 'my super support text for server 3',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + servers[2].port host: servers[2].host
}, },
isLocal, isLocal,
duration: 5, duration: 5,
@ -340,7 +340,7 @@ describe('Test multiple servers', function () {
support: 'my super support text for server 3-2', support: 'my super support text for server 3-2',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + servers[2].port host: servers[2].host
}, },
commentsEnabled: true, commentsEnabled: true,
downloadEnabled: true, downloadEnabled: true,
@ -649,7 +649,7 @@ describe('Test multiple servers', function () {
expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin) expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
const isLocal = server.url === 'http://localhost:' + servers[2].port const isLocal = server.url === servers[2].url
const checkAttributes = { const checkAttributes = {
name: 'my super video updated', name: 'my super video updated',
category: 10, category: 10,
@ -661,7 +661,7 @@ describe('Test multiple servers', function () {
originallyPublishedAt: '2019-02-11T13:38:14.449Z', originallyPublishedAt: '2019-02-11T13:38:14.449Z',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + servers[2].port host: servers[2].host
}, },
isLocal, isLocal,
duration: 5, duration: 5,
@ -830,7 +830,7 @@ describe('Test multiple servers', function () {
expect(comment).to.not.be.undefined expect(comment).to.not.be.undefined
expect(comment.inReplyToCommentId).to.be.null expect(comment.inReplyToCommentId).to.be.null
expect(comment.account.name).to.equal('root') expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + servers[0].port) expect(comment.account.host).to.equal(servers[0].host)
expect(comment.totalReplies).to.equal(3) expect(comment.totalReplies).to.equal(3)
expect(dateIsValid(comment.createdAt as string)).to.be.true expect(dateIsValid(comment.createdAt as string)).to.be.true
expect(dateIsValid(comment.updatedAt as string)).to.be.true expect(dateIsValid(comment.updatedAt as string)).to.be.true
@ -841,7 +841,7 @@ describe('Test multiple servers', function () {
expect(comment).to.not.be.undefined expect(comment).to.not.be.undefined
expect(comment.inReplyToCommentId).to.be.null expect(comment.inReplyToCommentId).to.be.null
expect(comment.account.name).to.equal('root') expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + servers[2].port) expect(comment.account.host).to.equal(servers[2].host)
expect(comment.totalReplies).to.equal(0) expect(comment.totalReplies).to.equal(0)
expect(dateIsValid(comment.createdAt as string)).to.be.true expect(dateIsValid(comment.createdAt as string)).to.be.true
expect(dateIsValid(comment.updatedAt as string)).to.be.true expect(dateIsValid(comment.updatedAt as string)).to.be.true
@ -858,25 +858,25 @@ describe('Test multiple servers', function () {
expect(tree.comment.text).equal('my super first comment') expect(tree.comment.text).equal('my super first comment')
expect(tree.comment.account.name).equal('root') expect(tree.comment.account.name).equal('root')
expect(tree.comment.account.host).equal('localhost:' + servers[0].port) expect(tree.comment.account.host).equal(servers[0].host)
expect(tree.children).to.have.lengthOf(2) expect(tree.children).to.have.lengthOf(2)
const firstChild = tree.children[0] const firstChild = tree.children[0]
expect(firstChild.comment.text).to.equal('my super answer to thread 1') expect(firstChild.comment.text).to.equal('my super answer to thread 1')
expect(firstChild.comment.account.name).equal('root') expect(firstChild.comment.account.name).equal('root')
expect(firstChild.comment.account.host).equal('localhost:' + servers[1].port) expect(firstChild.comment.account.host).equal(servers[1].host)
expect(firstChild.children).to.have.lengthOf(1) expect(firstChild.children).to.have.lengthOf(1)
childOfFirstChild = firstChild.children[0] childOfFirstChild = firstChild.children[0]
expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
expect(childOfFirstChild.comment.account.name).equal('root') expect(childOfFirstChild.comment.account.name).equal('root')
expect(childOfFirstChild.comment.account.host).equal('localhost:' + servers[2].port) expect(childOfFirstChild.comment.account.host).equal(servers[2].host)
expect(childOfFirstChild.children).to.have.lengthOf(0) expect(childOfFirstChild.children).to.have.lengthOf(0)
const secondChild = tree.children[1] const secondChild = tree.children[1]
expect(secondChild.comment.text).to.equal('my second answer to thread 1') expect(secondChild.comment.text).to.equal('my second answer to thread 1')
expect(secondChild.comment.account.name).equal('root') expect(secondChild.comment.account.name).equal('root')
expect(secondChild.comment.account.host).equal('localhost:' + servers[2].port) expect(secondChild.comment.account.host).equal(servers[2].host)
expect(secondChild.children).to.have.lengthOf(0) expect(secondChild.children).to.have.lengthOf(0)
} }
}) })
@ -935,7 +935,7 @@ describe('Test multiple servers', function () {
expect(comment).to.not.be.undefined expect(comment).to.not.be.undefined
expect(comment.inReplyToCommentId).to.be.null expect(comment.inReplyToCommentId).to.be.null
expect(comment.account.name).to.equal('root') expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + servers[2].port) expect(comment.account.host).to.equal(servers[2].host)
expect(comment.totalReplies).to.equal(0) expect(comment.totalReplies).to.equal(0)
expect(dateIsValid(comment.createdAt as string)).to.be.true expect(dateIsValid(comment.createdAt as string)).to.be.true
expect(dateIsValid(comment.updatedAt as string)).to.be.true expect(dateIsValid(comment.updatedAt as string)).to.be.true
@ -1042,7 +1042,7 @@ describe('Test multiple servers', function () {
const { data } = await server.videos.list() const { data } = await server.videos.list()
const video = data.find(v => v.name === 'minimum parameters') const video = data.find(v => v.name === 'minimum parameters')
const isLocal = server.url === 'http://localhost:' + servers[1].port const isLocal = server.url === servers[1].url
const checkAttributes = { const checkAttributes = {
name: 'minimum parameters', name: 'minimum parameters',
category: null, category: null,
@ -1053,7 +1053,7 @@ describe('Test multiple servers', function () {
support: null, support: null,
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + servers[1].port host: servers[1].host
}, },
isLocal, isLocal,
duration: 5, duration: 5,

View file

@ -33,7 +33,7 @@ describe('Test a single server', function () {
support: 'my super support text', support: 'my super support text',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + server.port host: server.host
}, },
isLocal: true, isLocal: true,
duration: 5, duration: 5,
@ -66,7 +66,7 @@ describe('Test a single server', function () {
support: 'my super support text updated', support: 'my super support text updated',
account: { account: {
name: 'root', name: 'root',
host: 'localhost:' + server.port host: server.host
}, },
isLocal: true, isLocal: true,
tags: [ 'tagup1', 'tagup2' ], tags: [ 'tagup1', 'tagup2' ],

View file

@ -373,7 +373,7 @@ describe('Test video channels', function () {
this.timeout(10000) this.timeout(10000)
for (const server of servers) { for (const server of servers) {
const channelURI = 'second_video_channel@localhost:' + servers[0].port const channelURI = 'second_video_channel@' + servers[0].host
const { total, data } = await server.videos.listByChannel({ handle: channelURI }) const { total, data } = await server.videos.listByChannel({ handle: channelURI })
expect(total).to.equal(1) expect(total).to.equal(1)
@ -396,13 +396,13 @@ describe('Test video channels', function () {
for (const server of servers) { for (const server of servers) {
{ {
const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port const secondChannelURI = 'second_video_channel@' + servers[0].host
const { total } = await server.videos.listByChannel({ handle: secondChannelURI }) const { total } = await server.videos.listByChannel({ handle: secondChannelURI })
expect(total).to.equal(0) expect(total).to.equal(0)
} }
{ {
const channelURI = 'root_channel@localhost:' + servers[0].port const channelURI = 'root_channel@' + servers[0].host
const { total, data } = await server.videos.listByChannel({ handle: channelURI }) const { total, data } = await server.videos.listByChannel({ handle: channelURI })
expect(total).to.equal(1) expect(total).to.equal(1)

View file

@ -63,8 +63,8 @@ describe('Test video comments', function () {
expect(comment.videoId).to.equal(videoId) expect(comment.videoId).to.equal(videoId)
expect(comment.id).to.equal(comment.threadId) expect(comment.id).to.equal(comment.threadId)
expect(comment.account.name).to.equal('root') expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + server.port) expect(comment.account.host).to.equal(server.host)
expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root') expect(comment.account.url).to.equal(server.url + '/accounts/root')
expect(comment.totalReplies).to.equal(0) expect(comment.totalReplies).to.equal(0)
expect(comment.totalRepliesFromVideoAuthor).to.equal(0) expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
expect(dateIsValid(comment.createdAt as string)).to.be.true expect(dateIsValid(comment.createdAt as string)).to.be.true
@ -85,7 +85,7 @@ describe('Test video comments', function () {
expect(comment.videoId).to.equal(videoId) expect(comment.videoId).to.equal(videoId)
expect(comment.id).to.equal(comment.threadId) expect(comment.id).to.equal(comment.threadId)
expect(comment.account.name).to.equal('root') expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + server.port) expect(comment.account.host).to.equal(server.host)
for (const avatar of comment.account.avatars) { for (const avatar of comment.account.avatars) {
await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png') await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png')

View file

@ -404,7 +404,7 @@ describe('Test video playlists', function () {
it('Should not list unlisted or private playlists', async function () { it('Should not list unlisted or private playlists', async function () {
for (const server of servers) { for (const server of servers) {
const results = [ const results = [
await server.playlists.listByAccount({ handle: 'root@localhost:' + servers[1].port, sort: '-createdAt' }), await server.playlists.listByAccount({ handle: 'root@' + servers[1].host, sort: '-createdAt' }),
await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' }) await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' })
] ]
@ -701,52 +701,52 @@ describe('Test video playlists', function () {
const position = 2 const position = 2
{ {
await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port }) await command.addToMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@localhost:' + servers[1].port }) await command.removeFromMyBlocklist({ token: userTokenServer1, account: 'root@' + servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
} }
{ {
await command.addToMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port }) await command.addToMyBlocklist({ token: userTokenServer1, server: servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
await command.removeFromMyBlocklist({ token: userTokenServer1, server: 'localhost:' + servers[1].port }) await command.removeFromMyBlocklist({ token: userTokenServer1, server: servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
} }
{ {
await command.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) await command.addToServerBlocklist({ account: 'root@' + servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
await command.removeFromServerBlocklist({ account: 'root@localhost:' + servers[1].port }) await command.removeFromServerBlocklist({ account: 'root@' + servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
} }
{ {
await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port }) await command.addToServerBlocklist({ server: servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) await command.removeFromServerBlocklist({ server: servers[1].host })
await waitJobs(servers) await waitJobs(servers)
await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)

View file

@ -300,7 +300,7 @@ describe('Test CLI wrapper', function () {
const stdout = await cliCommand.execWithEnv(`${cmd} redundancy ${params}`) const stdout = await cliCommand.execWithEnv(`${cmd} redundancy ${params}`)
expect(stdout).to.contain('super video') expect(stdout).to.contain('super video')
expect(stdout).to.contain(`localhost:${server.port}`) expect(stdout).to.contain(server.host)
} }
}) })

View file

@ -94,7 +94,7 @@ describe('Test prune storage scripts', function () {
// Lazy load the remote avatars // Lazy load the remote avatars
{ {
const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port }) const account = await servers[0].accounts.get({ accountName: 'root@' + servers[1].host })
for (const avatar of account.avatars) { for (const avatar of account.avatars) {
await makeGetRequest({ await makeGetRequest({
@ -106,7 +106,7 @@ describe('Test prune storage scripts', function () {
} }
{ {
const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port }) const account = await servers[1].accounts.get({ accountName: 'root@' + servers[0].host })
for (const avatar of account.avatars) { for (const avatar of account.avatars) {
await makeGetRequest({ await makeGetRequest({
url: servers[1].url, url: servers[1].url,

View file

@ -67,7 +67,7 @@ describe('Test update host scripts', function () {
for (const video of data) { for (const video of data) {
const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid) const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid)
expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid) expect(body.id).to.equal('http://127.0.0.1:9002/videos/watch/' + video.uuid)
const videoDetails = await server.videos.get({ id: video.uuid }) const videoDetails = await server.videos.get({ id: video.uuid })
@ -84,7 +84,7 @@ describe('Test update host scripts', function () {
for (const channel of data) { for (const channel of data) {
const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name) const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name)
expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.name) expect(body.id).to.equal('http://127.0.0.1:9002/video-channels/' + channel.name)
} }
}) })
@ -96,7 +96,7 @@ describe('Test update host scripts', function () {
const usernameWithDomain = account.name const usernameWithDomain = account.name
const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain) const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain)
expect(body.id).to.equal('http://localhost:9002/accounts/' + usernameWithDomain) expect(body.id).to.equal('http://127.0.0.1:9002/accounts/' + usernameWithDomain)
} }
}) })
@ -113,17 +113,17 @@ describe('Test update host scripts', function () {
expect(files).to.have.lengthOf(8) expect(files).to.have.lengthOf(8)
for (const file of files) { for (const file of files) {
expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket') expect(file.magnetUri).to.contain('127.0.0.1%3A9002%2Ftracker%2Fsocket')
expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2F') expect(file.magnetUri).to.contain('127.0.0.1%3A9002%2Fstatic%2F')
const torrent = await parseTorrentVideo(server, file) const torrent = await parseTorrentVideo(server, file)
const announceWS = torrent.announce.find(a => a === 'ws://localhost:9002/tracker/socket') const announceWS = torrent.announce.find(a => a === 'ws://127.0.0.1:9002/tracker/socket')
expect(announceWS).to.not.be.undefined expect(announceWS).to.not.be.undefined
const announceHttp = torrent.announce.find(a => a === 'http://localhost:9002/tracker/announce') const announceHttp = torrent.announce.find(a => a === 'http://127.0.0.1:9002/tracker/announce')
expect(announceHttp).to.not.be.undefined expect(announceHttp).to.not.be.undefined
expect(torrent.urlList[0]).to.contain('http://localhost:9002/static/') expect(torrent.urlList[0]).to.contain('http://127.0.0.1:9002/static/')
} }
} }
}) })

View file

@ -134,11 +134,9 @@ describe('Test a client controllers', function () {
expectedStatus: HttpStatusCode.OK_200 expectedStatus: HttpStatusCode.OK_200
}) })
const port = servers[0].port const expectedLink = `<link rel="alternate" type="application/json+oembed" href="${servers[0].url}/services/oembed?` +
`url=http%3A%2F%2F${servers[0].hostname}%3A${servers[0].port}%2Fw%2F${servers[0].store.video.shortUUID}" ` +
const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' + `title="${servers[0].store.video.name}" />`
`url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2F${servers[0].store.video.shortUUID}" ` +
`title="${servers[0].store.video.name}" />`
expect(res.text).to.contain(expectedLink) expect(res.text).to.contain(expectedLink)
} }
@ -155,10 +153,8 @@ describe('Test a client controllers', function () {
expectedStatus: HttpStatusCode.OK_200 expectedStatus: HttpStatusCode.OK_200
}) })
const port = servers[0].port const expectedLink = `<link rel="alternate" type="application/json+oembed" href="${servers[0].url}/services/oembed?` +
`url=http%3A%2F%2F${servers[0].hostname}%3A${servers[0].port}%2Fw%2Fp%2F${playlist.shortUUID}" ` +
const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +
`url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2Fp%2F${playlist.shortUUID}" ` +
`title="${playlistName}" />` `title="${playlistName}" />`
expect(res.text).to.contain(expectedLink) expect(res.text).to.contain(expectedLink)

View file

@ -32,7 +32,7 @@ describe('Official plugin auth-ldap', function () {
'mail-property': 'mail', 'mail-property': 'mail',
'search-base': 'ou=people,dc=planetexpress,dc=com', 'search-base': 'ou=people,dc=planetexpress,dc=com',
'search-filter': '(|(mail={{username}})(uid={{username}}))', 'search-filter': '(|(mail={{username}})(uid={{username}}))',
'url': 'ldap://localhost:390', 'url': 'ldap://127.0.0.1:390',
'username-property': 'uid' 'username-property': 'uid'
} }
}) })
@ -50,7 +50,7 @@ describe('Official plugin auth-ldap', function () {
'mail-property': 'mail', 'mail-property': 'mail',
'search-base': 'ou=people,dc=planetexpress,dc=com', 'search-base': 'ou=people,dc=planetexpress,dc=com',
'search-filter': '(|(mail={{username}})(uid={{username}}))', 'search-filter': '(|(mail={{username}})(uid={{username}}))',
'url': 'ldap://localhost:10389', 'url': 'ldap://127.0.0.1:10389',
'username-property': 'uid' 'username-property': 'uid'
} }
}) })

View file

@ -64,7 +64,7 @@ describe('Official plugin auto-block videos', function () {
await servers[0].plugins.updateSettings({ await servers[0].plugins.updateSettings({
npmName: 'peertube-plugin-auto-block-videos', npmName: 'peertube-plugin-auto-block-videos',
settings: { settings: {
'blocklist-urls': `http://localhost:${port}/blocklist`, 'blocklist-urls': `http://127.0.0.1:${port}/blocklist`,
'check-seconds-interval': 1 'check-seconds-interval': 1
} }
}) })

View file

@ -43,7 +43,7 @@ describe('Official plugin auto-mute', function () {
await servers[0].plugins.updateSettings({ await servers[0].plugins.updateSettings({
npmName: 'peertube-plugin-auto-mute', npmName: 'peertube-plugin-auto-mute',
settings: { settings: {
'blocklist-urls': `http://localhost:${port}/blocklist`, 'blocklist-urls': `http://127.0.0.1:${port}/blocklist`,
'check-seconds-interval': 1 'check-seconds-interval': 1
} }
}) })
@ -55,7 +55,7 @@ describe('Official plugin auto-mute', function () {
blocklistServer.replace({ blocklistServer.replace({
data: [ data: [
{ {
value: 'localhost:' + servers[1].port value: servers[1].host
} }
] ]
}) })
@ -72,7 +72,7 @@ describe('Official plugin auto-mute', function () {
blocklistServer.replace({ blocklistServer.replace({
data: [ data: [
{ {
value: 'localhost:' + servers[1].port, value: servers[1].host,
action: 'remove' action: 'remove'
} }
] ]
@ -90,7 +90,7 @@ describe('Official plugin auto-mute', function () {
blocklistServer.replace({ blocklistServer.replace({
data: [ data: [
{ {
value: 'root@localhost:' + servers[1].port value: 'root@' + servers[1].host
} }
] ]
}) })
@ -107,7 +107,7 @@ describe('Official plugin auto-mute', function () {
blocklistServer.replace({ blocklistServer.replace({
data: [ data: [
{ {
value: 'root@localhost:' + servers[1].port, value: 'root@' + servers[1].host,
action: 'remove' action: 'remove'
} }
] ]
@ -122,7 +122,7 @@ describe('Official plugin auto-mute', function () {
it('Should auto mute an account, manually unmute it and do not remute it automatically', async function () { it('Should auto mute an account, manually unmute it and do not remute it automatically', async function () {
this.timeout(20000) this.timeout(20000)
const account = 'root@localhost:' + servers[1].port const account = 'root@' + servers[1].host
blocklistServer.replace({ blocklistServer.replace({
data: [ data: [
@ -188,14 +188,14 @@ describe('Official plugin auto-mute', function () {
await servers[1].plugins.updateSettings({ await servers[1].plugins.updateSettings({
npmName: 'peertube-plugin-auto-mute', npmName: 'peertube-plugin-auto-mute',
settings: { settings: {
'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath, 'blocklist-urls': 'http://' + servers[0].host + autoMuteListPath,
'check-seconds-interval': 1, 'check-seconds-interval': 1,
'expose-mute-list': false 'expose-mute-list': false
} }
}) })
await servers[0].blocklist.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) await servers[0].blocklist.addToServerBlocklist({ account: 'root@' + servers[1].host })
await servers[0].blocklist.addToMyBlocklist({ server: 'localhost:' + servers[1].port }) await servers[0].blocklist.addToMyBlocklist({ server: servers[1].host })
const res = await makeGetRequest({ const res = await makeGetRequest({
url: servers[0].url, url: servers[0].url,
@ -206,7 +206,7 @@ describe('Official plugin auto-mute', function () {
const data = res.body.data const data = res.body.data
expect(data).to.have.lengthOf(1) expect(data).to.have.lengthOf(1)
expect(data[0].updatedAt).to.exist expect(data[0].updatedAt).to.exist
expect(data[0].value).to.equal('root@localhost:' + servers[1].port) expect(data[0].value).to.equal('root@' + servers[1].host)
await wait(2000) await wait(2000)

View file

@ -1,13 +1,13 @@
{ {
"type": "Announce", "type": "Announce",
"id": "http://localhost:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05/announces/1", "id": "http://127.0.0.1:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05/announces/1",
"actor": "http://localhost:9002/accounts/peertube", "actor": "http://127.0.0.1:9002/accounts/peertube",
"object": "http://localhost:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05", "object": "http://127.0.0.1:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05",
"to": [ "to": [
"https://www.w3.org/ns/activitystreams#Public", "https://www.w3.org/ns/activitystreams#Public",
"http://localhost:9002/accounts/peertube/followers", "http://127.0.0.1:9002/accounts/peertube/followers",
"http://localhost:9002/video-channels/root_channel/followers", "http://127.0.0.1:9002/video-channels/root_channel/followers",
"http://localhost:9002/accounts/root/followers" "http://127.0.0.1:9002/accounts/root/followers"
], ],
"cc": [] "cc": []
} }

View file

@ -41,7 +41,7 @@ describe('Request helpers', function () {
const port = await mock.initialize() const port = await mock.initialize()
const before = new Date().getTime() const before = new Date().getTime()
await doRequest('http://localhost:' + port) await doRequest('http://127.0.0.1:' + port)
expect(new Date().getTime() - before).to.be.greaterThan(2000) expect(new Date().getTime() - before).to.be.greaterThan(2000)

View file

@ -166,7 +166,7 @@ describe('Test misc endpoints', function () {
}) })
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/about/instance</loc></url>')
}) })
it('Should get the empty cached sitemap', async function () { it('Should get the empty cached sitemap', async function () {
@ -177,7 +177,7 @@ describe('Test misc endpoints', function () {
}) })
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/about/instance</loc></url>')
}) })
it('Should add videos, channel and accounts and get sitemap', async function () { it('Should add videos, channel and accounts and get sitemap', async function () {
@ -200,17 +200,17 @@ describe('Test misc endpoints', function () {
}) })
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/about/instance</loc></url>')
expect(res.text).to.contain('<video:title>video 1</video:title>') expect(res.text).to.contain('<video:title>video 1</video:title>')
expect(res.text).to.contain('<video:title>video 2</video:title>') expect(res.text).to.contain('<video:title>video 2</video:title>')
expect(res.text).to.not.contain('<video:title>video 3</video:title>') expect(res.text).to.not.contain('<video:title>video 3</video:title>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel1</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/video-channels/channel1</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel2</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/video-channels/channel2</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user1</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/accounts/user1</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user2</loc></url>') expect(res.text).to.contain('<url><loc>' + server.url + '/accounts/user2</loc></url>')
}) })
it('Should not fail with big title/description videos', async function () { it('Should not fail with big title/description videos', async function () {

View file

@ -46,7 +46,7 @@ describe('Test plugin helpers', function () {
describe('Logger', function () { describe('Logger', function () {
it('Should have logged things', async function () { it('Should have logged things', async function () {
await servers[0].servers.waitUntilLog('localhost:' + servers[0].port + ' peertube-plugin-test-four', 1, false) await servers[0].servers.waitUntilLog(servers[0].host + ' peertube-plugin-test-four', 1, false)
await servers[0].servers.waitUntilLog('Hello world from plugin four', 1) await servers[0].servers.waitUntilLog('Hello world from plugin four', 1)
}) })
}) })
@ -61,7 +61,7 @@ describe('Test plugin helpers', function () {
describe('Config', function () { describe('Config', function () {
it('Should have the correct webserver url', async function () { it('Should have the correct webserver url', async function () {
await servers[0].servers.waitUntilLog(`server url is http://localhost:${servers[0].port}`) await servers[0].servers.waitUntilLog(`server url is ${servers[0].url}`)
}) })
it('Should have the correct config', async function () { it('Should have the correct config', async function () {
@ -208,7 +208,7 @@ describe('Test plugin helpers', function () {
it('Should mute server 2', async function () { it('Should mute server 2', async function () {
this.timeout(10000) this.timeout(10000)
await postCommand(servers[0], 'blockServer', { hostToBlock: `localhost:${servers[1].port}` }) await postCommand(servers[0], 'blockServer', { hostToBlock: servers[1].host })
const { data } = await servers[0].videos.list() const { data } = await servers[0].videos.list()
@ -217,7 +217,7 @@ describe('Test plugin helpers', function () {
}) })
it('Should unmute server 2', async function () { it('Should unmute server 2', async function () {
await postCommand(servers[0], 'unblockServer', { hostToUnblock: `localhost:${servers[1].port}` }) await postCommand(servers[0], 'unblockServer', { hostToUnblock: servers[1].host })
const { data } = await servers[0].videos.list() const { data } = await servers[0].videos.list()
@ -225,7 +225,7 @@ describe('Test plugin helpers', function () {
}) })
it('Should mute account of server 2', async function () { it('Should mute account of server 2', async function () {
await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@localhost:${servers[1].port}` }) await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@${servers[1].host}` })
const { data } = await servers[0].videos.list() const { data } = await servers[0].videos.list()
@ -234,7 +234,7 @@ describe('Test plugin helpers', function () {
}) })
it('Should unmute account of server 2', async function () { it('Should unmute account of server 2', async function () {
await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@localhost:${servers[1].port}` }) await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@${servers[1].host}` })
const { data } = await servers[0].videos.list() const { data } = await servers[0].videos.list()

View file

@ -371,7 +371,7 @@ async function checkNewCommentOnMyVideo (options: CheckerBaseParams & {
} }
} }
const commentUrl = `http://localhost:${server.port}/w/${shortUUID};threadId=${threadId}` const commentUrl = `${server.url}/w/${shortUUID};threadId=${threadId}`
function emailNotificationFinder (email: object) { function emailNotificationFinder (email: object) {
return email['text'].indexOf(commentUrl) !== -1 return email['text'].indexOf(commentUrl) !== -1
@ -674,7 +674,7 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an
const overrideConfig = { const overrideConfig = {
smtp: { smtp: {
hostname: 'localhost', hostname: '127.0.0.1',
port port
}, },
signup: { signup: {

View file

@ -131,7 +131,7 @@ export class SQLCommand extends AbstractCommand {
const dbname = 'peertube_test' + this.server.internalServerNumber const dbname = 'peertube_test' + this.server.internalServerNumber
const username = 'peertube' const username = 'peertube'
const password = 'peertube' const password = 'peertube'
const host = 'localhost' const host = '127.0.0.1'
const port = 5432 const port = 5432
this.sequelize = new Sequelize(dbname, username, password, { this.sequelize = new Sequelize(dbname, username, password, {

View file

@ -179,9 +179,9 @@ export class PeerTubeServer {
this.rtmpsPort = this.parallel ? this.randomRTMP() : 1937 this.rtmpsPort = this.parallel ? this.randomRTMP() : 1937
this.port = 9000 + this.internalServerNumber this.port = 9000 + this.internalServerNumber
this.url = `http://localhost:${this.port}` this.url = `http://127.0.0.1:${this.port}`
this.host = `localhost:${this.port}` this.host = `127.0.0.1:${this.port}`
this.hostname = 'localhost' this.hostname = '127.0.0.1'
} }
setUrl (url: string) { setUrl (url: string) {

View file

@ -39,6 +39,7 @@ function sendRTMPStream (options: {
if (process.env.DEBUG) { if (process.env.DEBUG) {
command.on('stderr', data => console.log(data)) command.on('stderr', data => console.log(data))
command.on('stdout', data => console.log(data))
} }
command.run() command.run()