diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-13 14:23:01 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (patch) | |
tree | 7a166515e4d57a06eb3c08be569f106ed049988b /server/tests/api/moderation/abuses.ts | |
parent | d0a0fa429d4651710ed951a3c11af0219e408964 (diff) | |
download | PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip |
Introduce user command
Diffstat (limited to 'server/tests/api/moderation/abuses.ts')
-rw-r--r-- | server/tests/api/moderation/abuses.ts | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts index d7462f38f..a7119263c 100644 --- a/server/tests/api/moderation/abuses.ts +++ b/server/tests/api/moderation/abuses.ts | |||
@@ -5,13 +5,10 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | AbusesCommand, | 6 | AbusesCommand, |
7 | cleanupTests, | 7 | cleanupTests, |
8 | createUser, | ||
9 | doubleFollow, | 8 | doubleFollow, |
10 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
11 | generateUserAccessToken, | ||
12 | getVideoIdFromUUID, | 10 | getVideoIdFromUUID, |
13 | getVideosList, | 11 | getVideosList, |
14 | removeUser, | ||
15 | removeVideo, | 12 | removeVideo, |
16 | ServerInfo, | 13 | ServerInfo, |
17 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
@@ -278,7 +275,7 @@ describe('Test abuses', function () { | |||
278 | 275 | ||
279 | // register a second user to have two reporters/reportees | 276 | // register a second user to have two reporters/reportees |
280 | const user = { username: 'user2', password: 'password' } | 277 | const user = { username: 'user2', password: 'password' } |
281 | await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, ...user }) | 278 | await servers[0].usersCommand.create({ ...user }) |
282 | const userAccessToken = await servers[0].loginCommand.getAccessToken(user) | 279 | const userAccessToken = await servers[0].loginCommand.getAccessToken(user) |
283 | 280 | ||
284 | // upload a third video via this user | 281 | // upload a third video via this user |
@@ -604,9 +601,9 @@ describe('Test abuses', function () { | |||
604 | before(async function () { | 601 | before(async function () { |
605 | this.timeout(50000) | 602 | this.timeout(50000) |
606 | 603 | ||
607 | await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: 'user_1', password: 'donald' }) | 604 | await servers[0].usersCommand.create({ username: 'user_1', password: 'donald' }) |
608 | 605 | ||
609 | const token = await generateUserAccessToken(servers[1], 'user_2') | 606 | const token = await servers[1].usersCommand.generateUserAndToken('user_2') |
610 | await uploadVideo(servers[1].url, token, { name: 'super video' }) | 607 | await uploadVideo(servers[1].url, token, { name: 'super video' }) |
611 | 608 | ||
612 | await waitJobs(servers) | 609 | await waitJobs(servers) |
@@ -708,7 +705,7 @@ describe('Test abuses', function () { | |||
708 | this.timeout(10000) | 705 | this.timeout(10000) |
709 | 706 | ||
710 | const account = await getAccountFromServer(servers[1], 'user_2', servers[1]) | 707 | const account = await getAccountFromServer(servers[1], 'user_2', servers[1]) |
711 | await removeUser(servers[1].url, account.userId, servers[1].accessToken) | 708 | await servers[1].usersCommand.remove({ userId: account.userId }) |
712 | 709 | ||
713 | await waitJobs(servers) | 710 | await waitJobs(servers) |
714 | 711 | ||
@@ -765,7 +762,7 @@ describe('Test abuses', function () { | |||
765 | let userAccessToken: string | 762 | let userAccessToken: string |
766 | 763 | ||
767 | before(async function () { | 764 | before(async function () { |
768 | userAccessToken = await generateUserAccessToken(servers[0], 'user_42') | 765 | userAccessToken = await servers[0].usersCommand.generateUserAndToken('user_42') |
769 | 766 | ||
770 | await commands[0].report({ token: userAccessToken, videoId: servers[0].video.id, reason: 'user reason 1' }) | 767 | await commands[0].report({ token: userAccessToken, videoId: servers[0].video.id, reason: 'user reason 1' }) |
771 | 768 | ||
@@ -836,7 +833,7 @@ describe('Test abuses', function () { | |||
836 | let abuseMessageModerationId: number | 833 | let abuseMessageModerationId: number |
837 | 834 | ||
838 | before(async function () { | 835 | before(async function () { |
839 | userToken = await generateUserAccessToken(servers[0], 'user_43') | 836 | userToken = await servers[0].usersCommand.generateUserAndToken('user_43') |
840 | 837 | ||
841 | const body = await commands[0].report({ token: userToken, videoId: servers[0].video.id, reason: 'user 43 reason 1' }) | 838 | const body = await commands[0].report({ token: userToken, videoId: servers[0].video.id, reason: 'user 43 reason 1' }) |
842 | abuseId = body.abuse.id | 839 | abuseId = body.abuse.id |