aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 14:23:01 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (patch)
tree7a166515e4d57a06eb3c08be569f106ed049988b /server/tests/cli
parentd0a0fa429d4651710ed951a3c11af0219e408964 (diff)
downloadPeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip
Introduce user command
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/peertube.ts8
-rw-r--r--server/tests/cli/prune-storage.ts3
-rw-r--r--server/tests/cli/reset-password.ts4
-rw-r--r--server/tests/cli/update-host.ts3
4 files changed, 7 insertions, 11 deletions
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index e055b4684..a0c149ac0 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -8,11 +8,9 @@ import {
8 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
9 cleanupTests, 9 cleanupTests,
10 CLICommand, 10 CLICommand,
11 createUser,
12 doubleFollow, 11 doubleFollow,
13 flushAndRunServer, 12 flushAndRunServer,
14 getLocalIdByUUID, 13 getLocalIdByUUID,
15 getMyUserInformation,
16 getVideo, 14 getVideo,
17 getVideosList, 15 getVideosList,
18 ImportsCommand, 16 ImportsCommand,
@@ -38,7 +36,7 @@ describe('Test CLI wrapper', function () {
38 server = await flushAndRunServer(1) 36 server = await flushAndRunServer(1)
39 await setAccessTokensToServers([ server ]) 37 await setAccessTokensToServers([ server ])
40 38
41 await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super_password' }) 39 await server.usersCommand.create({ username: 'user_1', password: 'super_password' })
42 40
43 userAccessToken = await server.loginCommand.getAccessToken({ username: 'user_1', password: 'super_password' }) 41 userAccessToken = await server.loginCommand.getAccessToken({ username: 'user_1', password: 'super_password' })
44 42
@@ -56,8 +54,8 @@ describe('Test CLI wrapper', function () {
56 const stdout = await cliCommand.execWithEnv(`${cmd} token --url ${server.url} --username user_1 --password super_password`) 54 const stdout = await cliCommand.execWithEnv(`${cmd} token --url ${server.url} --username user_1 --password super_password`)
57 const token = stdout.trim() 55 const token = stdout.trim()
58 56
59 const res = await getMyUserInformation(server.url, token) 57 const body = await server.usersCommand.getMyInfo({ token })
60 expect(res.body.username).to.equal('user_1') 58 expect(body.username).to.equal('user_1')
61 }) 59 })
62 60
63 it('Should display no selected instance', async function () { 61 it('Should display no selected instance', async function () {
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts
index 68a59a41d..b45049964 100644
--- a/server/tests/cli/prune-storage.ts
+++ b/server/tests/cli/prune-storage.ts
@@ -16,7 +16,6 @@ import {
16 ServerInfo, 16 ServerInfo,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 setDefaultVideoChannel, 18 setDefaultVideoChannel,
19 updateMyAvatar,
20 uploadVideo, 19 uploadVideo,
21 wait, 20 wait,
22 waitJobs 21 waitJobs
@@ -73,7 +72,7 @@ describe('Test prune storage scripts', function () {
73 await uploadVideo(server.url, server.accessToken, { name: 'video 1' }) 72 await uploadVideo(server.url, server.accessToken, { name: 'video 1' })
74 await uploadVideo(server.url, server.accessToken, { name: 'video 2' }) 73 await uploadVideo(server.url, server.accessToken, { name: 'video 2' })
75 74
76 await updateMyAvatar({ url: server.url, accessToken: server.accessToken, fixture: 'avatar.png' }) 75 await server.usersCommand.updateMyAvatar({ fixture: 'avatar.png' })
77 76
78 await server.playlistsCommand.create({ 77 await server.playlistsCommand.create({
79 attributes: { 78 attributes: {
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts
index a5f958bf7..5e1e1c2af 100644
--- a/server/tests/cli/reset-password.ts
+++ b/server/tests/cli/reset-password.ts
@@ -1,5 +1,5 @@
1import 'mocha' 1import 'mocha'
2import { cleanupTests, CLICommand, createUser, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../shared/extra-utils' 2import { cleanupTests, CLICommand, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../shared/extra-utils'
3 3
4describe('Test reset password scripts', function () { 4describe('Test reset password scripts', function () {
5 let server: ServerInfo 5 let server: ServerInfo
@@ -9,7 +9,7 @@ describe('Test reset password scripts', function () {
9 server = await flushAndRunServer(1) 9 server = await flushAndRunServer(1)
10 await setAccessTokensToServers([ server ]) 10 await setAccessTokensToServers([ server ])
11 11
12 await createUser({ url: server.url, accessToken: server.accessToken, username: 'user_1', password: 'super password' }) 12 await server.usersCommand.create({ username: 'user_1', password: 'super password' })
13 }) 13 })
14 14
15 it('Should change the user password from CLI', async function () { 15 it('Should change the user password from CLI', async function () {
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts
index e986a04f2..b857fcf28 100644
--- a/server/tests/cli/update-host.ts
+++ b/server/tests/cli/update-host.ts
@@ -4,7 +4,6 @@ import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createUser,
8 flushAndRunServer, 7 flushAndRunServer,
9 getVideo, 8 getVideo,
10 getVideosList, 9 getVideosList,
@@ -41,7 +40,7 @@ describe('Test update host scripts', function () {
41 await uploadVideo(server.url, server.accessToken, videoAttributes) 40 await uploadVideo(server.url, server.accessToken, videoAttributes)
42 41
43 // Create a user 42 // Create a user
44 await createUser({ url: server.url, accessToken: server.accessToken, username: 'toto', password: 'coucou' }) 43 await server.usersCommand.create({ username: 'toto', password: 'coucou' })
45 44
46 // Create channel 45 // Create channel
47 const videoChannel = { 46 const videoChannel = {