From 8704acf49efc770d73bf07c10468ed8c74d28a83 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Thu, 13 Sep 2018 14:27:44 +0200 Subject: one cli to unite them all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ash nazg thrakatulûk agh burzum-ishi krimpatul - refactor import-videos to use the youtubeDL helper - add very basic tests for the cli --- server/tests/cli/index.ts | 1 + server/tests/cli/peertube.ts | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 server/tests/cli/peertube.ts (limited to 'server/tests') diff --git a/server/tests/cli/index.ts b/server/tests/cli/index.ts index f99eafe03..33e33a070 100644 --- a/server/tests/cli/index.ts +++ b/server/tests/cli/index.ts @@ -1,5 +1,6 @@ // Order of the tests we want to execute import './create-transcoding-job' import './create-import-video-file-job' +import './peertube' import './reset-password' import './update-host' diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts new file mode 100644 index 000000000..548fd1257 --- /dev/null +++ b/server/tests/cli/peertube.ts @@ -0,0 +1,51 @@ +import 'mocha' +import { + expect +} from 'chai' +import { + createUser, + execCLI, + flushTests, + getEnvCli, + killallServers, + runServer, + ServerInfo, + setAccessTokensToServers +} from '../utils' + +describe('Test CLI wrapper', function () { + let server: ServerInfo + const cmd = 'node ./dist/server/tools/peertube.js' + + before(async function () { + this.timeout(30000) + + await flushTests() + server = await runServer(1) + await setAccessTokensToServers([ server ]) + + await createUser(server.url, server.accessToken, 'user_1', 'super password') + }) + + 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) + const stdout = await execCLI(`${env} ` + cmd + ` auth add --url ${server.url} -U user_1 -p "super password"`) + }) + + after(async function () { + await execCLI(cmd + ` auth del ${server.url}`) + + killallServers([ server ]) + }) +}) -- cgit v1.2.3