diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-13 14:27:44 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-14 11:08:55 +0200 |
commit | 8704acf49efc770d73bf07c10468ed8c74d28a83 (patch) | |
tree | ffd46289fcf9a13ac4412b167e9f71dfb35753c5 /server/tests | |
parent | 1d9d9cfdcf3983e3fd89026bc4b5633a8abf5752 (diff) | |
download | PeerTube-8704acf49efc770d73bf07c10468ed8c74d28a83.tar.gz PeerTube-8704acf49efc770d73bf07c10468ed8c74d28a83.tar.zst PeerTube-8704acf49efc770d73bf07c10468ed8c74d28a83.zip |
one cli to unite them all
Ash nazg thrakatulûk agh burzum-ishi krimpatul
- refactor import-videos to use the youtubeDL helper
- add very basic tests for the cli
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/cli/index.ts | 1 | ||||
-rw-r--r-- | server/tests/cli/peertube.ts | 51 |
2 files changed, 52 insertions, 0 deletions
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 @@ | |||
1 | // Order of the tests we want to execute | 1 | // Order of the tests we want to execute |
2 | import './create-transcoding-job' | 2 | import './create-transcoding-job' |
3 | import './create-import-video-file-job' | 3 | import './create-import-video-file-job' |
4 | import './peertube' | ||
4 | import './reset-password' | 5 | import './reset-password' |
5 | import './update-host' | 6 | 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 @@ | |||
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) | ||
43 | const stdout = await execCLI(`${env} ` + cmd + ` auth add --url ${server.url} -U user_1 -p "super password"`) | ||
44 | }) | ||
45 | |||
46 | after(async function () { | ||
47 | await execCLI(cmd + ` auth del ${server.url}`) | ||
48 | |||
49 | killallServers([ server ]) | ||
50 | }) | ||
51 | }) | ||