aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 13:38:26 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit9fff08cf83f34339df7ed4ac770e1dee536adf9d (patch)
tree36eac5147a12ae257a3e8aaeffae37c9aed23d0a /server/tests/cli
parent87e2635a50ac2decb1c330e55c2ff7b6d07a85de (diff)
downloadPeerTube-9fff08cf83f34339df7ed4ac770e1dee536adf9d.tar.gz
PeerTube-9fff08cf83f34339df7ed4ac770e1dee536adf9d.tar.zst
PeerTube-9fff08cf83f34339df7ed4ac770e1dee536adf9d.zip
Introduce accounts command
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/prune-storage.ts17
-rw-r--r--server/tests/cli/update-host.ts18
2 files changed, 15 insertions, 20 deletions
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'
5import { createFile, readdir } from 'fs-extra' 5import { createFile, readdir } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { buildUUID } from '@server/helpers/uuid' 7import { buildUUID } from '@server/helpers/uuid'
8import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' 8import { HttpStatusCode } from '@shared/core-utils'
9import { 9import {
10 buildServerDirectory, 10 buildServerDirectory,
11 cleanupTests, 11 cleanupTests,
@@ -13,7 +13,6 @@ import {
13 createVideoPlaylist, 13 createVideoPlaylist,
14 doubleFollow, 14 doubleFollow,
15 flushAndRunMultipleServers, 15 flushAndRunMultipleServers,
16 getAccount,
17 killallServers, 16 killallServers,
18 makeGetRequest, 17 makeGetRequest,
19 ServerInfo, 18 ServerInfo,
@@ -21,10 +20,10 @@ import {
21 setDefaultVideoChannel, 20 setDefaultVideoChannel,
22 updateMyAvatar, 21 updateMyAvatar,
23 uploadVideo, 22 uploadVideo,
24 wait 23 wait,
25} from '../../../shared/extra-utils' 24 waitJobs
26import { waitJobs } from '../../../shared/extra-utils/server/jobs' 25} from '@shared/extra-utils'
27import { Account, VideoPlaylistPrivacy } from '../../../shared/models' 26import { VideoPlaylistPrivacy } from '@shared/models'
28 27
29const expect = chai.expect 28const expect = chai.expect
30 29
@@ -94,8 +93,7 @@ describe('Test prune storage scripts', function () {
94 93
95 // Lazy load the remote avatar 94 // Lazy load the remote avatar
96 { 95 {
97 const res = await getAccount(servers[0].url, 'root@localhost:' + servers[1].port) 96 const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port })
98 const account: Account = res.body
99 await makeGetRequest({ 97 await makeGetRequest({
100 url: servers[0].url, 98 url: servers[0].url,
101 path: account.avatar.path, 99 path: account.avatar.path,
@@ -104,8 +102,7 @@ describe('Test prune storage scripts', function () {
104 } 102 }
105 103
106 { 104 {
107 const res = await getAccount(servers[1].url, 'root@localhost:' + servers[0].port) 105 const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port })
108 const account: Account = res.body
109 await makeGetRequest({ 106 await makeGetRequest({
110 url: servers[1].url, 107 url: servers[1].url,
111 path: account.avatar.path, 108 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 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { 4import {
6 addVideoChannel, 5 addVideoChannel,
6 addVideoCommentThread,
7 cleanupTests, 7 cleanupTests,
8 createUser, 8 createUser,
9 flushAndRunServer, 9 flushAndRunServer,
@@ -16,12 +16,10 @@ import {
16 reRunServer, 16 reRunServer,
17 ServerInfo, 17 ServerInfo,
18 setAccessTokensToServers, 18 setAccessTokensToServers,
19 uploadVideo 19 uploadVideo,
20} from '../../../shared/extra-utils' 20 waitJobs
21import { waitJobs } from '../../../shared/extra-utils/server/jobs' 21} from '@shared/extra-utils'
22import { getAccountsList } from '../../../shared/extra-utils/users/accounts' 22import { VideoDetails } from '@shared/models'
23import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments'
24import { VideoDetails } from '../../../shared/models/videos'
25 23
26const expect = chai.expect 24const expect = chai.expect
27 25
@@ -104,10 +102,10 @@ describe('Test update host scripts', function () {
104 }) 102 })
105 103
106 it('Should have updated accounts url', async function () { 104 it('Should have updated accounts url', async function () {
107 const res = await getAccountsList(server.url) 105 const body = await server.accountsCommand.list()
108 expect(res.body.total).to.equal(3) 106 expect(body.total).to.equal(3)
109 107
110 for (const account of res.body.data) { 108 for (const account of body.data) {
111 const usernameWithDomain = account.name 109 const usernameWithDomain = account.name
112 const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain) 110 const { body } = await makeActivityPubGetRequest(server.url, '/accounts/' + usernameWithDomain)
113 111