diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:04:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 89d241a79c262b9775c233b73cff080043ebb5e6 (patch) | |
tree | cb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/users/users-multiple-servers.ts | |
parent | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff) | |
download | PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip |
Shorter server command names
Diffstat (limited to 'server/tests/api/users/users-multiple-servers.ts')
-rw-r--r-- | server/tests/api/users/users-multiple-servers.ts | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 3ae105008..f8d7ae88e 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts | |||
@@ -42,20 +42,20 @@ describe('Test users with multiple servers', function () { | |||
42 | await doubleFollow(servers[1], servers[2]) | 42 | await doubleFollow(servers[1], servers[2]) |
43 | 43 | ||
44 | // The root user of server 1 is propagated to servers 2 and 3 | 44 | // The root user of server 1 is propagated to servers 2 and 3 |
45 | await servers[0].videosCommand.upload() | 45 | await servers[0].videos.upload() |
46 | 46 | ||
47 | { | 47 | { |
48 | const user = { | 48 | const user = { |
49 | username: 'user1', | 49 | username: 'user1', |
50 | password: 'password' | 50 | password: 'password' |
51 | } | 51 | } |
52 | const created = await servers[0].usersCommand.create(user) | 52 | const created = await servers[0].users.create(user) |
53 | userId = created.id | 53 | userId = created.id |
54 | userAccessToken = await servers[0].loginCommand.getAccessToken(user) | 54 | userAccessToken = await servers[0].login.getAccessToken(user) |
55 | } | 55 | } |
56 | 56 | ||
57 | { | 57 | { |
58 | const { uuid } = await servers[0].videosCommand.upload({ token: userAccessToken }) | 58 | const { uuid } = await servers[0].videos.upload({ token: userAccessToken }) |
59 | videoUUID = uuid | 59 | videoUUID = uuid |
60 | } | 60 | } |
61 | 61 | ||
@@ -65,9 +65,9 @@ describe('Test users with multiple servers', function () { | |||
65 | it('Should be able to update my display name', async function () { | 65 | it('Should be able to update my display name', async function () { |
66 | this.timeout(10000) | 66 | this.timeout(10000) |
67 | 67 | ||
68 | await servers[0].usersCommand.updateMe({ displayName: 'my super display name' }) | 68 | await servers[0].users.updateMe({ displayName: 'my super display name' }) |
69 | 69 | ||
70 | user = await servers[0].usersCommand.getMyInfo() | 70 | user = await servers[0].users.getMyInfo() |
71 | expect(user.account.displayName).to.equal('my super display name') | 71 | expect(user.account.displayName).to.equal('my super display name') |
72 | 72 | ||
73 | await waitJobs(servers) | 73 | await waitJobs(servers) |
@@ -76,9 +76,9 @@ describe('Test users with multiple servers', function () { | |||
76 | it('Should be able to update my description', async function () { | 76 | it('Should be able to update my description', async function () { |
77 | this.timeout(10_000) | 77 | this.timeout(10_000) |
78 | 78 | ||
79 | await servers[0].usersCommand.updateMe({ description: 'my super description updated' }) | 79 | await servers[0].users.updateMe({ description: 'my super description updated' }) |
80 | 80 | ||
81 | user = await servers[0].usersCommand.getMyInfo() | 81 | user = await servers[0].users.getMyInfo() |
82 | expect(user.account.displayName).to.equal('my super display name') | 82 | expect(user.account.displayName).to.equal('my super display name') |
83 | expect(user.account.description).to.equal('my super description updated') | 83 | expect(user.account.description).to.equal('my super description updated') |
84 | 84 | ||
@@ -90,9 +90,9 @@ describe('Test users with multiple servers', function () { | |||
90 | 90 | ||
91 | const fixture = 'avatar2.png' | 91 | const fixture = 'avatar2.png' |
92 | 92 | ||
93 | await servers[0].usersCommand.updateMyAvatar({ fixture }) | 93 | await servers[0].users.updateMyAvatar({ fixture }) |
94 | 94 | ||
95 | user = await servers[0].usersCommand.getMyInfo() | 95 | user = await servers[0].users.getMyInfo() |
96 | userAvatarFilename = user.account.avatar.path | 96 | userAvatarFilename = user.account.avatar.path |
97 | 97 | ||
98 | await testImage(servers[0].url, 'avatar2-resized', userAvatarFilename, '.png') | 98 | await testImage(servers[0].url, 'avatar2-resized', userAvatarFilename, '.png') |
@@ -104,12 +104,12 @@ describe('Test users with multiple servers', function () { | |||
104 | let createdAt: string | Date | 104 | let createdAt: string | Date |
105 | 105 | ||
106 | for (const server of servers) { | 106 | for (const server of servers) { |
107 | const body = await server.accountsCommand.list({ sort: '-createdAt' }) | 107 | const body = await server.accounts.list({ sort: '-createdAt' }) |
108 | 108 | ||
109 | const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) | 109 | const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) |
110 | expect(resList).not.to.be.undefined | 110 | expect(resList).not.to.be.undefined |
111 | 111 | ||
112 | const account = await server.accountsCommand.get({ accountName: resList.name + '@' + resList.host }) | 112 | const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host }) |
113 | 113 | ||
114 | if (!createdAt) createdAt = account.createdAt | 114 | if (!createdAt) createdAt = account.createdAt |
115 | 115 | ||
@@ -131,7 +131,7 @@ describe('Test users with multiple servers', function () { | |||
131 | 131 | ||
132 | it('Should list account videos', async function () { | 132 | it('Should list account videos', async function () { |
133 | for (const server of servers) { | 133 | for (const server of servers) { |
134 | const { total, data } = await server.videosCommand.listByAccount({ accountName: 'user1@localhost:' + servers[0].port }) | 134 | const { total, data } = await server.videos.listByAccount({ accountName: 'user1@localhost:' + servers[0].port }) |
135 | 135 | ||
136 | expect(total).to.equal(1) | 136 | expect(total).to.equal(1) |
137 | expect(data).to.be.an('array') | 137 | expect(data).to.be.an('array') |
@@ -143,12 +143,12 @@ describe('Test users with multiple servers', function () { | |||
143 | it('Should search through account videos', async function () { | 143 | it('Should search through account videos', async function () { |
144 | this.timeout(10_000) | 144 | this.timeout(10_000) |
145 | 145 | ||
146 | const created = await servers[0].videosCommand.upload({ token: userAccessToken, attributes: { name: 'Kami no chikara' } }) | 146 | const created = await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'Kami no chikara' } }) |
147 | 147 | ||
148 | await waitJobs(servers) | 148 | await waitJobs(servers) |
149 | 149 | ||
150 | for (const server of servers) { | 150 | for (const server of servers) { |
151 | const { total, data } = await server.videosCommand.listByAccount({ accountName: 'user1@localhost:' + servers[0].port, search: 'Kami' }) | 151 | const { total, data } = await server.videos.listByAccount({ accountName: 'user1@localhost:' + servers[0].port, search: 'Kami' }) |
152 | 152 | ||
153 | expect(total).to.equal(1) | 153 | expect(total).to.equal(1) |
154 | expect(data).to.be.an('array') | 154 | expect(data).to.be.an('array') |
@@ -161,27 +161,27 @@ describe('Test users with multiple servers', function () { | |||
161 | this.timeout(10_000) | 161 | this.timeout(10_000) |
162 | 162 | ||
163 | for (const server of servers) { | 163 | for (const server of servers) { |
164 | const body = await server.accountsCommand.list({ sort: '-createdAt' }) | 164 | const body = await server.accounts.list({ sort: '-createdAt' }) |
165 | 165 | ||
166 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) | 166 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) |
167 | expect(accountDeleted).not.to.be.undefined | 167 | expect(accountDeleted).not.to.be.undefined |
168 | 168 | ||
169 | const { data } = await server.channelsCommand.list() | 169 | const { data } = await server.channels.list() |
170 | const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) | 170 | const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) |
171 | expect(videoChannelDeleted).not.to.be.undefined | 171 | expect(videoChannelDeleted).not.to.be.undefined |
172 | } | 172 | } |
173 | 173 | ||
174 | await servers[0].usersCommand.remove({ userId }) | 174 | await servers[0].users.remove({ userId }) |
175 | 175 | ||
176 | await waitJobs(servers) | 176 | await waitJobs(servers) |
177 | 177 | ||
178 | for (const server of servers) { | 178 | for (const server of servers) { |
179 | const body = await server.accountsCommand.list({ sort: '-createdAt' }) | 179 | const body = await server.accounts.list({ sort: '-createdAt' }) |
180 | 180 | ||
181 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) | 181 | const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) |
182 | expect(accountDeleted).to.be.undefined | 182 | expect(accountDeleted).to.be.undefined |
183 | 183 | ||
184 | const { data } = await server.channelsCommand.list() | 184 | const { data } = await server.channels.list() |
185 | const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) | 185 | const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) |
186 | expect(videoChannelDeleted).to.be.undefined | 186 | expect(videoChannelDeleted).to.be.undefined |
187 | } | 187 | } |