diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-13 11:09:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-13 11:09:38 +0200 |
commit | 1a12f66d631d28a5a58ebbcd274426f2e6e5d203 (patch) | |
tree | edaf546dfc8bcdb55d271111618e65569aa68cc0 /server/tools/peertube-get-access-token.ts | |
parent | 4913295f9db1a7b814129d90b159a418cb32bb75 (diff) | |
download | PeerTube-1a12f66d631d28a5a58ebbcd274426f2e6e5d203.tar.gz PeerTube-1a12f66d631d28a5a58ebbcd274426f2e6e5d203.tar.zst PeerTube-1a12f66d631d28a5a58ebbcd274426f2e6e5d203.zip |
Add more CLI tests
Diffstat (limited to 'server/tools/peertube-get-access-token.ts')
-rw-r--r-- | server/tools/peertube-get-access-token.ts | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts index 85660de2c..103495347 100644 --- a/server/tools/peertube-get-access-token.ts +++ b/server/tools/peertube-get-access-token.ts | |||
@@ -1,12 +1,5 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | 2 | import { getClient, Server, serverLogin } from '../../shared/extra-utils' | |
3 | import { | ||
4 | getClient, | ||
5 | serverLogin, | ||
6 | Server, | ||
7 | Client, | ||
8 | User | ||
9 | } from '../../shared/extra-utils' | ||
10 | 3 | ||
11 | program | 4 | program |
12 | .option('-u, --url <url>', 'Server url') | 5 | .option('-u, --url <url>', 'Server url') |
@@ -22,6 +15,7 @@ if ( | |||
22 | if (!program['url']) console.error('--url field is required.') | 15 | if (!program['url']) console.error('--url field is required.') |
23 | if (!program['username']) console.error('--username field is required.') | 16 | if (!program['username']) console.error('--username field is required.') |
24 | if (!program['password']) console.error('--password field is required.') | 17 | if (!program['password']) console.error('--password field is required.') |
18 | |||
25 | process.exit(-1) | 19 | process.exit(-1) |
26 | } | 20 | } |
27 | 21 | ||
@@ -32,11 +26,11 @@ getClient(program.url) | |||
32 | user: { | 26 | user: { |
33 | username: program['username'], | 27 | username: program['username'], |
34 | password: program['password'] | 28 | password: program['password'] |
35 | } as User, | 29 | }, |
36 | client: { | 30 | client: { |
37 | id: res.body.client_id as string, | 31 | id: res.body.client_id, |
38 | secret: res.body.client_secret as string | 32 | secret: res.body.client_secret |
39 | } as Client | 33 | } |
40 | } as Server | 34 | } as Server |
41 | 35 | ||
42 | return serverLogin(server) | 36 | return serverLogin(server) |