reset-password.ts 914 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import 'mocha'
  2. import {
  3. cleanupTests,
  4. createUser,
  5. execCLI,
  6. flushAndRunServer,
  7. getEnvCli,
  8. login,
  9. ServerInfo,
  10. setAccessTokensToServers
  11. } from '../../../shared/extra-utils'
  12. describe('Test reset password scripts', function () {
  13. let server: ServerInfo
  14. before(async function () {
  15. this.timeout(30000)
  16. server = await flushAndRunServer(1)
  17. await setAccessTokensToServers([ server ])
  18. await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' })
  19. })
  20. it('Should change the user password from CLI', async function () {
  21. this.timeout(60000)
  22. const env = getEnvCli(server)
  23. await execCLI(`echo coucou | ${env} npm run reset-password -- -u user_1`)
  24. await login(server.url, server.client, { username: 'user_1', password: 'coucou' }, 200)
  25. })
  26. after(async function () {
  27. await cleanupTests([ server ])
  28. })
  29. })