2018-09-13 14:27:44 +02:00
|
|
|
import 'mocha'
|
|
|
|
import {
|
|
|
|
expect
|
|
|
|
} from 'chai'
|
|
|
|
import {
|
|
|
|
createUser,
|
|
|
|
execCLI,
|
|
|
|
flushTests,
|
|
|
|
getEnvCli,
|
|
|
|
killallServers,
|
2019-04-24 10:53:40 +02:00
|
|
|
flushAndRunServer,
|
2018-09-13 14:27:44 +02:00
|
|
|
ServerInfo,
|
2019-04-24 15:10:37 +02:00
|
|
|
setAccessTokensToServers, cleanupTests
|
2019-04-15 15:26:15 +02:00
|
|
|
} from '../../../shared/extra-utils'
|
2018-09-13 14:27:44 +02:00
|
|
|
|
|
|
|
describe('Test CLI wrapper', function () {
|
|
|
|
let server: ServerInfo
|
|
|
|
const cmd = 'node ./dist/server/tools/peertube.js'
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
this.timeout(30000)
|
2019-04-24 10:53:40 +02:00
|
|
|
server = await flushAndRunServer(1)
|
2018-09-13 14:27:44 +02:00
|
|
|
await setAccessTokensToServers([ server ])
|
|
|
|
|
2019-04-15 10:49:46 +02:00
|
|
|
await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' })
|
2018-09-13 14:27:44 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should display no selected instance', async function () {
|
|
|
|
this.timeout(60000)
|
|
|
|
|
|
|
|
const env = getEnvCli(server)
|
|
|
|
const stdout = await execCLI(`${env} ${cmd} --help`)
|
|
|
|
|
|
|
|
expect(stdout).to.contain('selected')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should remember the authentifying material of the user', async function () {
|
|
|
|
this.timeout(60000)
|
|
|
|
|
|
|
|
const env = getEnvCli(server)
|
2018-09-20 16:35:48 +02:00
|
|
|
await execCLI(`${env} ` + cmd + ` auth add --url ${server.url} -U user_1 -p "super password"`)
|
2018-09-13 14:27:44 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
after(async function () {
|
2018-11-14 15:45:50 +01:00
|
|
|
this.timeout(10000)
|
|
|
|
|
2018-09-13 14:27:44 +02:00
|
|
|
await execCLI(cmd + ` auth del ${server.url}`)
|
|
|
|
|
2019-04-24 15:10:37 +02:00
|
|
|
await cleanupTests([ server ])
|
2018-09-13 14:27:44 +02:00
|
|
|
})
|
|
|
|
})
|