diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/activitypub/refresher.ts | 20 | ||||
-rw-r--r-- | server/tests/api/check-params/accounts.ts | 15 | ||||
-rw-r--r-- | server/tests/api/moderation/abuses.ts | 13 | ||||
-rw-r--r-- | server/tests/api/notifications/moderation-notifications.ts | 5 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 40 | ||||
-rw-r--r-- | server/tests/api/users/users-multiple-servers.ts | 37 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 20 | ||||
-rw-r--r-- | server/tests/cli/prune-storage.ts | 17 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 18 | ||||
-rw-r--r-- | server/tests/client.ts | 4 |
10 files changed, 89 insertions, 100 deletions
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index c717f1a30..0d5452ea4 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts | |||
@@ -1,8 +1,10 @@ | |||
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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/core-utils' | ||
4 | import { | 5 | import { |
5 | cleanupTests, closeAllSequelize, | 6 | cleanupTests, |
7 | closeAllSequelize, | ||
6 | createVideoPlaylist, | 8 | createVideoPlaylist, |
7 | doubleFollow, | 9 | doubleFollow, |
8 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
@@ -21,10 +23,8 @@ import { | |||
21 | uploadVideoAndGetId, | 23 | uploadVideoAndGetId, |
22 | wait, | 24 | wait, |
23 | waitJobs | 25 | waitJobs |
24 | } from '../../../../shared/extra-utils' | 26 | } from '@shared/extra-utils' |
25 | import { getAccount } from '../../../../shared/extra-utils/users/accounts' | 27 | import { VideoPlaylistPrivacy } from '@shared/models' |
26 | import { VideoPlaylistPrivacy } from '../../../../shared/models/videos' | ||
27 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
28 | 28 | ||
29 | describe('Test AP refresher', function () { | 29 | describe('Test AP refresher', function () { |
30 | let servers: ServerInfo[] = [] | 30 | let servers: ServerInfo[] = [] |
@@ -116,19 +116,21 @@ describe('Test AP refresher', function () { | |||
116 | it('Should remove a deleted actor', async function () { | 116 | it('Should remove a deleted actor', async function () { |
117 | this.timeout(60000) | 117 | this.timeout(60000) |
118 | 118 | ||
119 | const command = servers[0].accountsCommand | ||
120 | |||
119 | await wait(10000) | 121 | await wait(10000) |
120 | 122 | ||
121 | // Change actor name so the remote server returns a 404 | 123 | // Change actor name so the remote server returns a 404 |
122 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' | 124 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' |
123 | await setActorField(servers[1].internalServerNumber, to, 'preferredUsername', 'toto') | 125 | await setActorField(servers[1].internalServerNumber, to, 'preferredUsername', 'toto') |
124 | 126 | ||
125 | await getAccount(servers[0].url, 'user1@localhost:' + servers[1].port) | 127 | await command.get({ accountName: 'user1@localhost:' + servers[1].port }) |
126 | await getAccount(servers[0].url, 'user2@localhost:' + servers[1].port) | 128 | await command.get({ accountName: 'user2@localhost:' + servers[1].port }) |
127 | 129 | ||
128 | await waitJobs(servers) | 130 | await waitJobs(servers) |
129 | 131 | ||
130 | await getAccount(servers[0].url, 'user1@localhost:' + servers[1].port, HttpStatusCode.OK_200) | 132 | await command.get({ accountName: 'user1@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.OK_200 }) |
131 | await getAccount(servers[0].url, 'user2@localhost:' + servers[1].port, HttpStatusCode.NOT_FOUND_404) | 133 | await command.get({ accountName: 'user2@localhost:' + servers[1].port, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
132 | }) | 134 | }) |
133 | }) | 135 | }) |
134 | 136 | ||
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts index d1712cff6..45d440c47 100644 --- a/server/tests/api/check-params/accounts.ts +++ b/server/tests/api/check-params/accounts.ts | |||
@@ -1,15 +1,15 @@ | |||
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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | 4 | import { HttpStatusCode } from '@shared/core-utils' | |
5 | import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils' | ||
6 | import { | 5 | import { |
7 | checkBadCountPagination, | 6 | checkBadCountPagination, |
8 | checkBadSortPagination, | 7 | checkBadSortPagination, |
9 | checkBadStartPagination | 8 | checkBadStartPagination, |
10 | } from '../../../../shared/extra-utils/requests/check-api-params' | 9 | cleanupTests, |
11 | import { getAccount } from '../../../../shared/extra-utils/users/accounts' | 10 | flushAndRunServer, |
12 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 11 | ServerInfo |
12 | } from '@shared/extra-utils' | ||
13 | 13 | ||
14 | describe('Test accounts API validators', function () { | 14 | describe('Test accounts API validators', function () { |
15 | const path = '/api/v1/accounts/' | 15 | const path = '/api/v1/accounts/' |
@@ -38,8 +38,9 @@ describe('Test accounts API validators', function () { | |||
38 | }) | 38 | }) |
39 | 39 | ||
40 | describe('When getting an account', function () { | 40 | describe('When getting an account', function () { |
41 | |||
41 | it('Should return 404 with a non existing name', async function () { | 42 | it('Should return 404 with a non existing name', async function () { |
42 | await getAccount(server.url, 'arfaze', HttpStatusCode.NOT_FOUND_404) | 43 | await server.accountsCommand.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
43 | }) | 44 | }) |
44 | }) | 45 | }) |
45 | 46 | ||
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts index a9f5332ce..124833cf6 100644 --- a/server/tests/api/moderation/abuses.ts +++ b/server/tests/api/moderation/abuses.ts | |||
@@ -13,7 +13,6 @@ import { | |||
13 | doubleFollow, | 13 | doubleFollow, |
14 | flushAndRunMultipleServers, | 14 | flushAndRunMultipleServers, |
15 | generateUserAccessToken, | 15 | generateUserAccessToken, |
16 | getAccount, | ||
17 | getVideoCommentThreads, | 16 | getVideoCommentThreads, |
18 | getVideoIdFromUUID, | 17 | getVideoIdFromUUID, |
19 | getVideosList, | 18 | getVideosList, |
@@ -606,10 +605,8 @@ describe('Test abuses', function () { | |||
606 | 605 | ||
607 | describe('Account abuses', function () { | 606 | describe('Account abuses', function () { |
608 | 607 | ||
609 | async function getAccountFromServer (url: string, name: string, server: ServerInfo) { | 608 | function getAccountFromServer (server: ServerInfo, targetName: string, targetServer: ServerInfo) { |
610 | const res = await getAccount(url, name + '@' + server.host) | 609 | return server.accountsCommand.get({ accountName: targetName + '@' + targetServer.host }) |
611 | |||
612 | return res.body as Account | ||
613 | } | 610 | } |
614 | 611 | ||
615 | before(async function () { | 612 | before(async function () { |
@@ -626,7 +623,7 @@ describe('Test abuses', function () { | |||
626 | it('Should report abuse on an account', async function () { | 623 | it('Should report abuse on an account', async function () { |
627 | this.timeout(15000) | 624 | this.timeout(15000) |
628 | 625 | ||
629 | const account = await getAccountFromServer(servers[0].url, 'user_1', servers[0]) | 626 | const account = await getAccountFromServer(servers[0], 'user_1', servers[0]) |
630 | 627 | ||
631 | const reason = 'it is a bad account' | 628 | const reason = 'it is a bad account' |
632 | await commands[0].report({ accountId: account.id, reason }) | 629 | await commands[0].report({ accountId: account.id, reason }) |
@@ -664,7 +661,7 @@ describe('Test abuses', function () { | |||
664 | it('Should report abuse on a remote account', async function () { | 661 | it('Should report abuse on a remote account', async function () { |
665 | this.timeout(10000) | 662 | this.timeout(10000) |
666 | 663 | ||
667 | const account = await getAccountFromServer(servers[0].url, 'user_2', servers[1]) | 664 | const account = await getAccountFromServer(servers[0], 'user_2', servers[1]) |
668 | 665 | ||
669 | const reason = 'it is a really bad account' | 666 | const reason = 'it is a really bad account' |
670 | await commands[0].report({ accountId: account.id, reason }) | 667 | await commands[0].report({ accountId: account.id, reason }) |
@@ -718,7 +715,7 @@ describe('Test abuses', function () { | |||
718 | it('Should keep the account abuse when deleting the account', async function () { | 715 | it('Should keep the account abuse when deleting the account', async function () { |
719 | this.timeout(10000) | 716 | this.timeout(10000) |
720 | 717 | ||
721 | const account = await getAccountFromServer(servers[1].url, 'user_2', servers[1]) | 718 | const account = await getAccountFromServer(servers[1], 'user_2', servers[1]) |
722 | await removeUser(servers[1].url, account.userId, servers[1].accessToken) | 719 | await removeUser(servers[1].url, account.userId, servers[1].accessToken) |
723 | 720 | ||
724 | await waitJobs(servers) | 721 | await waitJobs(servers) |
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index 3e66e7517..e90640ad6 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts | |||
@@ -22,7 +22,6 @@ import { | |||
22 | cleanupTests, | 22 | cleanupTests, |
23 | createUser, | 23 | createUser, |
24 | generateUserAccessToken, | 24 | generateUserAccessToken, |
25 | getAccount, | ||
26 | getVideoCommentThreads, | 25 | getVideoCommentThreads, |
27 | getVideoIdFromUUID, | 26 | getVideoIdFromUUID, |
28 | immutableAssign, | 27 | immutableAssign, |
@@ -157,8 +156,8 @@ describe('Test moderation notifications', function () { | |||
157 | 156 | ||
158 | await waitJobs(servers) | 157 | await waitJobs(servers) |
159 | 158 | ||
160 | const resAccount = await getAccount(servers[1].url, username + '@' + servers[0].host) | 159 | const account = await servers[1].accountsCommand.get({ accountName: username + '@' + servers[0].host }) |
161 | await servers[1].abusesCommand.report({ accountId: resAccount.body.id, reason: 'super reason' }) | 160 | await servers[1].abusesCommand.report({ accountId: account.id, reason: 'super reason' }) |
162 | 161 | ||
163 | await waitJobs(servers) | 162 | await waitJobs(servers) |
164 | await checkNewAccountAbuseForModerators(baseParams, username, 'presence') | 163 | await checkNewAccountAbuseForModerators(baseParams, username, 'presence') |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index c8fcca02c..466932d63 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -242,16 +242,16 @@ describe('Test follows', function () { | |||
242 | }) | 242 | }) |
243 | 243 | ||
244 | it('Should have the correct follows counts', async function () { | 244 | it('Should have the correct follows counts', async function () { |
245 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[0].port, 0, 2) | 245 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 2 }) |
246 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[1].port, 1, 0) | 246 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) |
247 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[2].port, 1, 0) | 247 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) |
248 | 248 | ||
249 | // Server 2 and 3 does not know server 1 follow another server (there was not a refresh) | 249 | // Server 2 and 3 does not know server 1 follow another server (there was not a refresh) |
250 | await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[0].port, 0, 1) | 250 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) |
251 | await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[1].port, 1, 0) | 251 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) |
252 | 252 | ||
253 | await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[0].port, 0, 1) | 253 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) |
254 | await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[2].port, 1, 0) | 254 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) |
255 | }) | 255 | }) |
256 | 256 | ||
257 | it('Should unfollow server 3 on server 1', async function () { | 257 | it('Should unfollow server 3 on server 1', async function () { |
@@ -283,14 +283,14 @@ describe('Test follows', function () { | |||
283 | }) | 283 | }) |
284 | 284 | ||
285 | it('Should have the correct follows counts 2', async function () { | 285 | it('Should have the correct follows counts 2', async function () { |
286 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[0].port, 0, 1) | 286 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) |
287 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[1].port, 1, 0) | 287 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) |
288 | 288 | ||
289 | await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[0].port, 0, 1) | 289 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) |
290 | await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[1].port, 1, 0) | 290 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) |
291 | 291 | ||
292 | await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[0].port, 0, 0) | 292 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 0 }) |
293 | await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[2].port, 0, 0) | 293 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[2].port, followers: 0, following: 0 }) |
294 | }) | 294 | }) |
295 | 295 | ||
296 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { | 296 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { |
@@ -404,15 +404,15 @@ describe('Test follows', function () { | |||
404 | }) | 404 | }) |
405 | 405 | ||
406 | it('Should have the correct follows counts 3', async function () { | 406 | it('Should have the correct follows counts 3', async function () { |
407 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[0].port, 0, 2) | 407 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 2 }) |
408 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[1].port, 1, 0) | 408 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) |
409 | await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[2].port, 1, 0) | 409 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) |
410 | 410 | ||
411 | await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[0].port, 0, 1) | 411 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) |
412 | await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[1].port, 1, 0) | 412 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) |
413 | 413 | ||
414 | await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[0].port, 0, 1) | 414 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) |
415 | await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[2].port, 1, 0) | 415 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) |
416 | }) | 416 | }) |
417 | 417 | ||
418 | it('Should have propagated videos', async function () { | 418 | it('Should have propagated videos', async function () { |
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 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
5 | import { Account } from '../../../../shared/models/actors' | 4 | import * as chai from 'chai' |
6 | import { | 5 | import { |
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, |
19 | import { getMyUserInformation, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../../../shared/extra-utils/index' | 24 | waitJobs |
20 | import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../../../shared/extra-utils/users/accounts' | 25 | } from '@shared/extra-utils' |
21 | import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' | 26 | import { User, VideoChannel } from '@shared/models' |
22 | import { User } from '../../../../shared/models/users' | ||
23 | import { VideoChannel } from '../../../../shared/models/videos' | ||
24 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | ||
25 | 27 | ||
26 | const expect = chai.expect | 28 | const 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) |
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 33bcc8701..3beea5d50 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -11,7 +11,6 @@ import { | |||
11 | createUser, | 11 | createUser, |
12 | deleteMe, | 12 | deleteMe, |
13 | flushAndRunServer, | 13 | flushAndRunServer, |
14 | getAccountRatings, | ||
15 | getBlacklistedVideosList, | 14 | getBlacklistedVideosList, |
16 | getMyUserInformation, | 15 | getMyUserInformation, |
17 | getMyUserVideoQuotaUsed, | 16 | getMyUserVideoQuotaUsed, |
@@ -194,25 +193,22 @@ describe('Test users', function () { | |||
194 | it('Should retrieve ratings list', async function () { | 193 | it('Should retrieve ratings list', async function () { |
195 | await rateVideo(server.url, accessToken, videoId, 'like') | 194 | await rateVideo(server.url, accessToken, videoId, 'like') |
196 | 195 | ||
197 | const res = await getAccountRatings(server.url, server.user.username, server.accessToken, null, HttpStatusCode.OK_200) | 196 | const body = await server.accountsCommand.listRatings({ accountName: server.user.username }) |
198 | const ratings = res.body | ||
199 | 197 | ||
200 | expect(ratings.total).to.equal(1) | 198 | expect(body.total).to.equal(1) |
201 | expect(ratings.data[0].video.id).to.equal(videoId) | 199 | expect(body.data[0].video.id).to.equal(videoId) |
202 | expect(ratings.data[0].rating).to.equal('like') | 200 | expect(body.data[0].rating).to.equal('like') |
203 | }) | 201 | }) |
204 | 202 | ||
205 | it('Should retrieve ratings list by rating type', async function () { | 203 | it('Should retrieve ratings list by rating type', async function () { |
206 | { | 204 | { |
207 | const res = await getAccountRatings(server.url, server.user.username, server.accessToken, 'like') | 205 | const body = await server.accountsCommand.listRatings({ accountName: server.user.username, rating: 'like' }) |
208 | const ratings = res.body | 206 | expect(body.data.length).to.equal(1) |
209 | expect(ratings.data.length).to.equal(1) | ||
210 | } | 207 | } |
211 | 208 | ||
212 | { | 209 | { |
213 | const res = await getAccountRatings(server.url, server.user.username, server.accessToken, 'dislike') | 210 | const body = await server.accountsCommand.listRatings({ accountName: server.user.username, rating: 'dislike' }) |
214 | const ratings = res.body | 211 | expect(body.data.length).to.equal(0) |
215 | expect(ratings.data.length).to.equal(0) | ||
216 | } | 212 | } |
217 | }) | 213 | }) |
218 | }) | 214 | }) |
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 81f91105c..95f573e50 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -5,7 +5,7 @@ import * as chai from 'chai' | |||
5 | import { createFile, readdir } from 'fs-extra' | 5 | import { createFile, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { buildUUID } from '@server/helpers/uuid' | 7 | import { buildUUID } from '@server/helpers/uuid' |
8 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 8 | import { HttpStatusCode } from '@shared/core-utils' |
9 | import { | 9 | import { |
10 | buildServerDirectory, | 10 | buildServerDirectory, |
11 | cleanupTests, | 11 | cleanupTests, |
@@ -13,7 +13,6 @@ import { | |||
13 | createVideoPlaylist, | 13 | createVideoPlaylist, |
14 | doubleFollow, | 14 | doubleFollow, |
15 | flushAndRunMultipleServers, | 15 | flushAndRunMultipleServers, |
16 | getAccount, | ||
17 | killallServers, | 16 | killallServers, |
18 | makeGetRequest, | 17 | makeGetRequest, |
19 | ServerInfo, | 18 | ServerInfo, |
@@ -21,10 +20,10 @@ import { | |||
21 | setDefaultVideoChannel, | 20 | setDefaultVideoChannel, |
22 | updateMyAvatar, | 21 | updateMyAvatar, |
23 | uploadVideo, | 22 | uploadVideo, |
24 | wait | 23 | wait, |
25 | } from '../../../shared/extra-utils' | 24 | waitJobs |
26 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' | 25 | } from '@shared/extra-utils' |
27 | import { Account, VideoPlaylistPrivacy } from '../../../shared/models' | 26 | import { VideoPlaylistPrivacy } from '@shared/models' |
28 | 27 | ||
29 | const expect = chai.expect | 28 | const expect = chai.expect |
30 | 29 | ||
@@ -94,8 +93,7 @@ describe('Test prune storage scripts', function () { | |||
94 | 93 | ||
95 | // Lazy load the remote avatar | 94 | // Lazy load the remote avatar |
96 | { | 95 | { |
97 | const res = await getAccount(servers[0].url, 'root@localhost:' + servers[1].port) | 96 | const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port }) |
98 | const account: Account = res.body | ||
99 | await makeGetRequest({ | 97 | await makeGetRequest({ |
100 | url: servers[0].url, | 98 | url: servers[0].url, |
101 | path: account.avatar.path, | 99 | path: account.avatar.path, |
@@ -104,8 +102,7 @@ describe('Test prune storage scripts', function () { | |||
104 | } | 102 | } |
105 | 103 | ||
106 | { | 104 | { |
107 | const res = await getAccount(servers[1].url, 'root@localhost:' + servers[0].port) | 105 | const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port }) |
108 | const account: Account = res.body | ||
109 | await makeGetRequest({ | 106 | await makeGetRequest({ |
110 | url: servers[1].url, | 107 | url: servers[1].url, |
111 | path: account.avatar.path, | 108 | path: account.avatar.path, |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 1b1a76aef..f6131a99f 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { | 4 | import { |
6 | addVideoChannel, | 5 | addVideoChannel, |
6 | addVideoCommentThread, | ||
7 | cleanupTests, | 7 | cleanupTests, |
8 | createUser, | 8 | createUser, |
9 | flushAndRunServer, | 9 | flushAndRunServer, |
@@ -16,12 +16,10 @@ import { | |||
16 | reRunServer, | 16 | reRunServer, |
17 | ServerInfo, | 17 | ServerInfo, |
18 | setAccessTokensToServers, | 18 | setAccessTokensToServers, |
19 | uploadVideo | 19 | uploadVideo, |
20 | } from '../../../shared/extra-utils' | 20 | waitJobs |
21 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' | 21 | } from '@shared/extra-utils' |
22 | import { getAccountsList } from '../../../shared/extra-utils/users/accounts' | 22 | import { VideoDetails } from '@shared/models' |
23 | import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments' | ||
24 | import { VideoDetails } from '../../../shared/models/videos' | ||
25 | 23 | ||
26 | const expect = chai.expect | 24 | const expect = chai.expect |
27 | 25 | ||
@@ -104,10 +102,10 @@ describe('Test update host scripts', function () { | |||
104 | }) | 102 | }) |
105 | 103 | ||
106 | it('Should have updated accounts url', async function () { | 104 | it('Should have updated accounts url', async function () { |
107 | const res = await getAccountsList(server.url) | 105 | const body = await server.accountsCommand.list() |
108 | expect(res.body.total).to.equal(3) | 106 | expect(body.total).to.equal(3) |
109 | 107 | ||
110 | for (const account of res.body.data) { | 108 | for (const account of body.data) { |
111 | const usernameWithDomain = account.name | 109 | const usernameWithDomain = account.name |
112 | const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain) | 110 | const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain) |
113 | 111 | ||
diff --git a/server/tests/client.ts b/server/tests/client.ts index be7ce18b4..60df878d7 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -11,7 +11,6 @@ import { | |||
11 | createVideoPlaylist, | 11 | createVideoPlaylist, |
12 | doubleFollow, | 12 | doubleFollow, |
13 | flushAndRunMultipleServers, | 13 | flushAndRunMultipleServers, |
14 | getAccount, | ||
15 | getVideosList, | 14 | getVideosList, |
16 | makeGetRequest, | 15 | makeGetRequest, |
17 | makeHTMLRequest, | 16 | makeHTMLRequest, |
@@ -105,8 +104,7 @@ describe('Test a client controllers', function () { | |||
105 | 104 | ||
106 | await updateMyUser({ url: servers[0].url, accessToken: servers[0].accessToken, description: 'my account description' }) | 105 | await updateMyUser({ url: servers[0].url, accessToken: servers[0].accessToken, description: 'my account description' }) |
107 | 106 | ||
108 | const resAccountRequest = await getAccount(servers[0].url, `${servers[0].user.username}@${servers[0].host}`) | 107 | account = await servers[0].accountsCommand.get({ accountName: `${servers[0].user.username}@${servers[0].host}` }) |
109 | account = resAccountRequest.body | ||
110 | 108 | ||
111 | await waitJobs(servers) | 109 | await waitJobs(servers) |
112 | }) | 110 | }) |