diff options
Diffstat (limited to 'server/tests/cli/reset-password.ts')
-rw-r--r-- | server/tests/cli/reset-password.ts | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts index a84463b33..4a02db35d 100644 --- a/server/tests/cli/reset-password.ts +++ b/server/tests/cli/reset-password.ts | |||
@@ -1,35 +1,24 @@ | |||
1 | import 'mocha' | 1 | import 'mocha' |
2 | 2 | import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '../../../shared/extra-utils' | |
3 | import { | ||
4 | cleanupTests, | ||
5 | createUser, | ||
6 | execCLI, | ||
7 | flushAndRunServer, | ||
8 | getEnvCli, | ||
9 | login, | ||
10 | ServerInfo, | ||
11 | setAccessTokensToServers | ||
12 | } from '../../../shared/extra-utils' | ||
13 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
14 | 3 | ||
15 | describe('Test reset password scripts', function () { | 4 | describe('Test reset password scripts', function () { |
16 | let server: ServerInfo | 5 | let server: PeerTubeServer |
17 | 6 | ||
18 | before(async function () { | 7 | before(async function () { |
19 | this.timeout(30000) | 8 | this.timeout(30000) |
20 | server = await flushAndRunServer(1) | 9 | server = await createSingleServer(1) |
21 | await setAccessTokensToServers([ server ]) | 10 | await setAccessTokensToServers([ server ]) |
22 | 11 | ||
23 | await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) | 12 | await server.users.create({ username: 'user_1', password: 'super password' }) |
24 | }) | 13 | }) |
25 | 14 | ||
26 | it('Should change the user password from CLI', async function () { | 15 | it('Should change the user password from CLI', async function () { |
27 | this.timeout(60000) | 16 | this.timeout(60000) |
28 | 17 | ||
29 | const env = getEnvCli(server) | 18 | const env = server.cli.getEnv() |
30 | await execCLI(`echo coucou | ${env} npm run reset-password -- -u user_1`) | 19 | await CLICommand.exec(`echo coucou | ${env} npm run reset-password -- -u user_1`) |
31 | 20 | ||
32 | await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, HttpStatusCode.OK_200) | 21 | await server.login.login({ user: { username: 'user_1', password: 'coucou' } }) |
33 | }) | 22 | }) |
34 | 23 | ||
35 | after(async function () { | 24 | after(async function () { |