From 9fff08cf83f34339df7ed4ac770e1dee536adf9d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Jul 2021 13:38:26 +0200 Subject: Introduce accounts command --- server/tests/cli/prune-storage.ts | 17 +++++++---------- server/tests/cli/update-host.ts | 18 ++++++++---------- 2 files changed, 15 insertions(+), 20 deletions(-) (limited to 'server/tests/cli') diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 81f91105c..95f573e50 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts @@ -5,7 +5,7 @@ import * as chai from 'chai' import { createFile, readdir } from 'fs-extra' import { join } from 'path' import { buildUUID } from '@server/helpers/uuid' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '@shared/core-utils' import { buildServerDirectory, cleanupTests, @@ -13,7 +13,6 @@ import { createVideoPlaylist, doubleFollow, flushAndRunMultipleServers, - getAccount, killallServers, makeGetRequest, ServerInfo, @@ -21,10 +20,10 @@ import { setDefaultVideoChannel, updateMyAvatar, uploadVideo, - wait -} from '../../../shared/extra-utils' -import { waitJobs } from '../../../shared/extra-utils/server/jobs' -import { Account, VideoPlaylistPrivacy } from '../../../shared/models' + wait, + waitJobs +} from '@shared/extra-utils' +import { VideoPlaylistPrivacy } from '@shared/models' const expect = chai.expect @@ -94,8 +93,7 @@ describe('Test prune storage scripts', function () { // Lazy load the remote avatar { - const res = await getAccount(servers[0].url, 'root@localhost:' + servers[1].port) - const account: Account = res.body + const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port }) await makeGetRequest({ url: servers[0].url, path: account.avatar.path, @@ -104,8 +102,7 @@ describe('Test prune storage scripts', function () { } { - const res = await getAccount(servers[1].url, 'root@localhost:' + servers[0].port) - const account: Account = res.body + const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port }) await makeGetRequest({ url: servers[1].url, path: account.avatar.path, diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 1b1a76aef..f6131a99f 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import * as chai from 'chai' import { addVideoChannel, + addVideoCommentThread, cleanupTests, createUser, flushAndRunServer, @@ -16,12 +16,10 @@ import { reRunServer, ServerInfo, setAccessTokensToServers, - uploadVideo -} from '../../../shared/extra-utils' -import { waitJobs } from '../../../shared/extra-utils/server/jobs' -import { getAccountsList } from '../../../shared/extra-utils/users/accounts' -import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments' -import { VideoDetails } from '../../../shared/models/videos' + uploadVideo, + waitJobs +} from '@shared/extra-utils' +import { VideoDetails } from '@shared/models' const expect = chai.expect @@ -104,10 +102,10 @@ describe('Test update host scripts', function () { }) it('Should have updated accounts url', async function () { - const res = await getAccountsList(server.url) - expect(res.body.total).to.equal(3) + const body = await server.accountsCommand.list() + expect(body.total).to.equal(3) - for (const account of res.body.data) { + for (const account of body.data) { const usernameWithDomain = account.name const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain) -- cgit v1.2.3