]>
Commit | Line | Data |
---|---|---|
8704acf4 RK |
1 | import 'mocha' |
2 | import { | |
3 | expect | |
4 | } from 'chai' | |
5 | import { | |
6 | createUser, | |
7 | execCLI, | |
8 | flushTests, | |
9 | getEnvCli, | |
10 | killallServers, | |
11 | runServer, | |
12 | ServerInfo, | |
13 | setAccessTokensToServers | |
14 | } from '../utils' | |
15 | ||
16 | describe('Test CLI wrapper', function () { | |
17 | let server: ServerInfo | |
18 | const cmd = 'node ./dist/server/tools/peertube.js' | |
19 | ||
20 | before(async function () { | |
21 | this.timeout(30000) | |
22 | ||
23 | await flushTests() | |
24 | server = await runServer(1) | |
25 | await setAccessTokensToServers([ server ]) | |
26 | ||
27 | await createUser(server.url, server.accessToken, 'user_1', 'super password') | |
28 | }) | |
29 | ||
30 | it('Should display no selected instance', async function () { | |
31 | this.timeout(60000) | |
32 | ||
33 | const env = getEnvCli(server) | |
34 | const stdout = await execCLI(`${env} ${cmd} --help`) | |
35 | ||
36 | expect(stdout).to.contain('selected') | |
37 | }) | |
38 | ||
39 | it('Should remember the authentifying material of the user', async function () { | |
40 | this.timeout(60000) | |
41 | ||
42 | const env = getEnvCli(server) | |
5c142a4b | 43 | await execCLI(`${env} ` + cmd + ` auth add --url ${server.url} -U user_1 -p "super password"`) |
8704acf4 RK |
44 | }) |
45 | ||
46 | after(async function () { | |
47 | await execCLI(cmd + ` auth del ${server.url}`) | |
48 | ||
49 | killallServers([ server ]) | |
50 | }) | |
51 | }) |