]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/cli/peertube.ts
Rename overview -> discover
[github/Chocobozzz/PeerTube.git] / server / tests / cli / peertube.ts
CommitLineData
8704acf4
RK
1import 'mocha'
2import {
3 expect
4} from 'chai'
5import {
6 createUser,
7 execCLI,
8 flushTests,
9 getEnvCli,
10 killallServers,
210feb6c 11 flushAndRunServer,
8704acf4 12 ServerInfo,
7c3b7976 13 setAccessTokensToServers, cleanupTests
94565d52 14} from '../../../shared/extra-utils'
8704acf4
RK
15
16describe('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)
210feb6c 22 server = await flushAndRunServer(1)
8704acf4
RK
23 await setAccessTokensToServers([ server ])
24
1eddc9a7 25 await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' })
8704acf4
RK
26 })
27
28 it('Should display no selected instance', async function () {
29 this.timeout(60000)
30
31 const env = getEnvCli(server)
32 const stdout = await execCLI(`${env} ${cmd} --help`)
33
34 expect(stdout).to.contain('selected')
35 })
36
37 it('Should remember the authentifying material of the user', async function () {
38 this.timeout(60000)
39
40 const env = getEnvCli(server)
5c142a4b 41 await execCLI(`${env} ` + cmd + ` auth add --url ${server.url} -U user_1 -p "super password"`)
8704acf4
RK
42 })
43
44 after(async function () {
e5cb43e0
C
45 this.timeout(10000)
46
8704acf4
RK
47 await execCLI(cmd + ` auth del ${server.url}`)
48
7c3b7976 49 await cleanupTests([ server ])
8704acf4
RK
50 })
51})