aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users/users-multiple-servers.ts
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/api/users/users-multiple-servers.ts
parentd0a0fa429d4651710ed951a3c11af0219e408964 (diff)
downloadPeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip
Introduce user command
Diffstat (limited to 'server/tests/api/users/users-multiple-servers.ts')
-rw-r--r--server/tests/api/users/users-multiple-servers.ts45
1 files changed, 9 insertions, 36 deletions
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 99fa08fe2..43e67ee60 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -7,17 +7,12 @@ import {
7 checkTmpIsEmpty, 7 checkTmpIsEmpty,
8 checkVideoFilesWereRemoved, 8 checkVideoFilesWereRemoved,
9 cleanupTests, 9 cleanupTests,
10 createUser,
11 doubleFollow, 10 doubleFollow,
12 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
13 getAccountVideos, 12 getAccountVideos,
14 getMyUserInformation,
15 removeUser,
16 ServerInfo, 13 ServerInfo,
17 setAccessTokensToServers, 14 setAccessTokensToServers,
18 testImage, 15 testImage,
19 updateMyAvatar,
20 updateMyUser,
21 uploadVideo, 16 uploadVideo,
22 waitJobs 17 waitJobs
23} from '@shared/extra-utils' 18} from '@shared/extra-utils'
@@ -56,13 +51,8 @@ describe('Test users with multiple servers', function () {
56 username: 'user1', 51 username: 'user1',
57 password: 'password' 52 password: 'password'
58 } 53 }
59 const res = await createUser({ 54 const created = await servers[0].usersCommand.create(user)
60 url: servers[0].url, 55 userId = created.id
61 accessToken: servers[0].accessToken,
62 username: user.username,
63 password: user.password
64 })
65 userId = res.body.user.id
66 userAccessToken = await servers[0].loginCommand.getAccessToken(user) 56 userAccessToken = await servers[0].loginCommand.getAccessToken(user)
67 } 57 }
68 58
@@ -77,15 +67,9 @@ describe('Test users with multiple servers', function () {
77 it('Should be able to update my display name', async function () { 67 it('Should be able to update my display name', async function () {
78 this.timeout(10000) 68 this.timeout(10000)
79 69
80 await updateMyUser({ 70 await servers[0].usersCommand.updateMe({ displayName: 'my super display name' })
81 url: servers[0].url,
82 accessToken: servers[0].accessToken,
83 displayName: 'my super display name'
84 })
85
86 const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)
87 user = res.body
88 71
72 user = await servers[0].usersCommand.getMyInfo()
89 expect(user.account.displayName).to.equal('my super display name') 73 expect(user.account.displayName).to.equal('my super display name')
90 74
91 await waitJobs(servers) 75 await waitJobs(servers)
@@ -94,14 +78,9 @@ describe('Test users with multiple servers', function () {
94 it('Should be able to update my description', async function () { 78 it('Should be able to update my description', async function () {
95 this.timeout(10_000) 79 this.timeout(10_000)
96 80
97 await updateMyUser({ 81 await servers[0].usersCommand.updateMe({ description: 'my super description updated' })
98 url: servers[0].url,
99 accessToken: servers[0].accessToken,
100 description: 'my super description updated'
101 })
102 82
103 const res = await getMyUserInformation(servers[0].url, servers[0].accessToken) 83 user = await servers[0].usersCommand.getMyInfo()
104 user = res.body
105 expect(user.account.displayName).to.equal('my super display name') 84 expect(user.account.displayName).to.equal('my super display name')
106 expect(user.account.description).to.equal('my super description updated') 85 expect(user.account.description).to.equal('my super description updated')
107 86
@@ -113,15 +92,9 @@ describe('Test users with multiple servers', function () {
113 92
114 const fixture = 'avatar2.png' 93 const fixture = 'avatar2.png'
115 94
116 await updateMyAvatar({ 95 await servers[0].usersCommand.updateMyAvatar({ fixture })
117 url: servers[0].url,
118 accessToken: servers[0].accessToken,
119 fixture
120 })
121
122 const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)
123 user = res.body
124 96
97 user = await servers[0].usersCommand.getMyInfo()
125 userAvatarFilename = user.account.avatar.path 98 userAvatarFilename = user.account.avatar.path
126 99
127 await testImage(servers[0].url, 'avatar2-resized', userAvatarFilename, '.png') 100 await testImage(servers[0].url, 'avatar2-resized', userAvatarFilename, '.png')
@@ -202,7 +175,7 @@ describe('Test users with multiple servers', function () {
202 expect(videoChannelDeleted).not.to.be.undefined 175 expect(videoChannelDeleted).not.to.be.undefined
203 } 176 }
204 177
205 await removeUser(servers[0].url, userId, servers[0].accessToken) 178 await servers[0].usersCommand.remove({ userId })
206 179
207 await waitJobs(servers) 180 await waitJobs(servers)
208 181