X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fusers%2Fusers-multiple-servers.ts;h=3823b74eff6a713c11b1d7dc38a3f75e178f03e7;hb=cffef25313bdf7a6c435f56ac6715fdd91acf7b3;hp=d1b9f76f9a011d39e82f25400ec02588aa820869;hpb=e0faa8ad6e18ce6248ef1ec93a59dab5b05be468;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index d1b9f76f9..3823b74ef 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkActorFilesWereRemoved, checkTmpIsEmpty, @@ -19,8 +19,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test users with multiple servers', function () { let servers: PeerTubeServer[] = [] @@ -68,8 +66,6 @@ describe('Test users with multiple servers', function () { }) it('Should be able to update my display name', async function () { - this.timeout(10000) - await servers[0].users.updateMe({ displayName: 'my super display name' }) user = await servers[0].users.getMyInfo() @@ -113,7 +109,7 @@ describe('Test users with multiple servers', function () { for (const server of servers) { 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 const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host }) @@ -121,7 +117,7 @@ describe('Test users with multiple servers', function () { if (!createdAt) createdAt = account.createdAt 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.description).to.equal('my super description updated') expect(createdAt).to.equal(account.createdAt) @@ -140,7 +136,7 @@ describe('Test users with multiple servers', function () { it('Should list account videos', async function () { 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(data).to.be.an('array') @@ -150,14 +146,12 @@ describe('Test users with multiple servers', function () { }) it('Should search through account videos', async function () { - this.timeout(10_000) - const created = await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'Kami no chikara' } }) await waitJobs(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(data).to.be.an('array') @@ -172,11 +166,11 @@ describe('Test users with multiple servers', function () { for (const server of servers) { 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 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 } @@ -187,11 +181,11 @@ describe('Test users with multiple servers', function () { for (const server of servers) { 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 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 } }) @@ -199,7 +193,7 @@ describe('Test users with multiple servers', function () { it('Should not have actor files', async () => { for (const server of servers) { for (const userAvatarFilename of userAvatarFilenames) { - await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber) + await checkActorFilesWereRemoved(userAvatarFilename, server) } } })