From 078f17e6d90376050f43ce639e88e11869b49ee7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 9 Jul 2021 15:03:44 +0200 Subject: Fix CLI tools --- server/tests/cli/peertube.ts | 9 +++++++++ server/tests/cli/update-host.ts | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index ef7ab5bd5..5ab07edb0 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts @@ -12,6 +12,7 @@ import { doubleFollow, flushAndRunServer, getLocalIdByUUID, + getMyUserInformation, getVideo, getVideosList, ImportsCommand, @@ -52,6 +53,14 @@ describe('Test CLI wrapper', function () { describe('Authentication and instance selection', function () { + it('Should get an access token', async function () { + const stdout = await cliCommand.execWithEnv(`${cmd} token --url ${server.url} --username user_1 --password super_password`) + const token = stdout.trim() + + const res = await getMyUserInformation(server.url, token) + expect(res.body.username).to.equal('user_1') + }) + it('Should display no selected instance', async function () { this.timeout(60000) diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 61a6c403a..d3a1520cf 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { expect } from 'chai' import { cleanupTests, createUser, @@ -18,8 +19,6 @@ import { } from '@shared/extra-utils' import { VideoDetails } from '@shared/models' -const expect = chai.expect - describe('Test update host scripts', function () { let server: ServerInfo -- cgit v1.2.3