diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-07 15:27:35 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-07 15:54:34 +0200 |
commit | fdbda9e3d6564ec908733c7019305f6a3c363a9f (patch) | |
tree | c596034156f167e7cfafe41c4a3fc6adda488a0d /server/tests/cli/reset-password.ts | |
parent | 04de542abd940f9d2ca213fba3c68580c6c9b78a (diff) | |
download | PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.gz PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.zst PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.zip |
Add tests for npm run scripts
Diffstat (limited to 'server/tests/cli/reset-password.ts')
-rw-r--r-- | server/tests/cli/reset-password.ts | 45 |
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 @@ | |||
1 | import 'mocha' | ||
2 | |||
3 | import { | ||
4 | createUser, | ||
5 | execCLI, | ||
6 | flushTests, | ||
7 | getEnvCli, | ||
8 | killallServers, | ||
9 | login, | ||
10 | runServer, | ||
11 | ServerInfo, | ||
12 | setAccessTokensToServers | ||
13 | } from '../utils' | ||
14 | |||
15 | describe('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 | }) | ||