aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users/users-multiple-servers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users/users-multiple-servers.ts')
-rw-r--r--server/tests/api/users/users-multiple-servers.ts37
1 files changed, 19 insertions, 18 deletions
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index f60c66e4b..03fbfabeb 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -1,9 +1,9 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
5import { Account } from '../../../../shared/models/actors' 4import * as chai from 'chai'
6import { 5import {
6 checkActorFilesWereRemoved,
7 checkTmpIsEmpty, 7 checkTmpIsEmpty,
8 checkVideoFilesWereRemoved, 8 checkVideoFilesWereRemoved,
9 cleanupTests, 9 cleanupTests,
@@ -11,17 +11,19 @@ import {
11 doubleFollow, 11 doubleFollow,
12 flushAndRunMultipleServers, 12 flushAndRunMultipleServers,
13 getAccountVideos, 13 getAccountVideos,
14 getMyUserInformation,
14 getVideoChannelsList, 15 getVideoChannelsList,
15 removeUser, 16 removeUser,
17 ServerInfo,
18 setAccessTokensToServers,
19 testImage,
20 updateMyAvatar,
16 updateMyUser, 21 updateMyUser,
17 userLogin 22 uploadVideo,
18} from '../../../../shared/extra-utils' 23 userLogin,
19import { getMyUserInformation, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../../../shared/extra-utils/index' 24 waitJobs
20import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../../../shared/extra-utils/users/accounts' 25} from '@shared/extra-utils'
21import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' 26import { User, VideoChannel } from '@shared/models'
22import { User } from '../../../../shared/models/users'
23import { VideoChannel } from '../../../../shared/models/videos'
24import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
25 27
26const expect = chai.expect 28const expect = chai.expect
27 29
@@ -133,13 +135,12 @@ describe('Test users with multiple servers', function () {
133 let createdAt: string | Date 135 let createdAt: string | Date
134 136
135 for (const server of servers) { 137 for (const server of servers) {
136 const resAccounts = await getAccountsList(server.url, '-createdAt') 138 const body = await server.accountsCommand.list({ sort: '-createdAt' })
137 139
138 const resList = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) as Account 140 const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port)
139 expect(resList).not.to.be.undefined 141 expect(resList).not.to.be.undefined
140 142
141 const resAccount = await getAccount(server.url, resList.name + '@' + resList.host) 143 const account = await server.accountsCommand.get({ accountName: resList.name + '@' + resList.host })
142 const account = resAccount.body as Account
143 144
144 if (!createdAt) createdAt = account.createdAt 145 if (!createdAt) createdAt = account.createdAt
145 146
@@ -193,9 +194,9 @@ describe('Test users with multiple servers', function () {
193 this.timeout(10_000) 194 this.timeout(10_000)
194 195
195 for (const server of servers) { 196 for (const server of servers) {
196 const resAccounts = await getAccountsList(server.url, '-createdAt') 197 const body = await server.accountsCommand.list({ sort: '-createdAt' })
197 198
198 const accountDeleted = resAccounts.body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) as Account 199 const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port)
199 expect(accountDeleted).not.to.be.undefined 200 expect(accountDeleted).not.to.be.undefined
200 201
201 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10) 202 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10)
@@ -210,9 +211,9 @@ describe('Test users with multiple servers', function () {
210 await waitJobs(servers) 211 await waitJobs(servers)
211 212
212 for (const server of servers) { 213 for (const server of servers) {
213 const resAccounts = await getAccountsList(server.url, '-createdAt') 214 const body = await server.accountsCommand.list({ sort: '-createdAt' })
214 215
215 const accountDeleted = resAccounts.body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) as Account 216 const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port)
216 expect(accountDeleted).to.be.undefined 217 expect(accountDeleted).to.be.undefined
217 218
218 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10) 219 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10)