aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/reset-password.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli/reset-password.ts')
-rw-r--r--server/tests/cli/reset-password.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts
new file mode 100644
index 000000000..bbf0b3d11
--- /dev/null
+++ b/server/tests/cli/reset-password.ts
@@ -0,0 +1,45 @@
1import 'mocha'
2
3import {
4 createUser,
5 execCLI,
6 flushTests,
7 getEnvCli,
8 killallServers,
9 login,
10 runServer,
11 ServerInfo,
12 setAccessTokensToServers
13} from '../utils'
14
15describe('Test reset password scripts', function () {
16 let server: ServerInfo
17
18 before(async function () {
19 this.timeout(30000)
20
21 await flushTests()
22 server = await runServer(1)
23 await setAccessTokensToServers([ server ])
24
25 await createUser(server.url, server.accessToken, 'user_1', 'super password')
26 })
27
28 it('Should change the user password from CLI', async function () {
29 this.timeout(20000)
30
31 const env = getEnvCli(server)
32 await execCLI(`echo coucou | ${env} npm run reset-password -- -u user_1`)
33
34 await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, 200)
35 })
36
37 after(async function () {
38 killallServers([ server ])
39
40 // Keep the logs if the test failed
41 if (this['ok']) {
42 await flushTests()
43 }
44 })
45})