aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users')
-rw-r--r--server/tests/api/users/user-subscriptions.ts34
-rw-r--r--server/tests/api/users/users-multiple-servers.ts18
-rw-r--r--server/tests/api/users/users.ts6
3 files changed, 29 insertions, 29 deletions
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 48811e647..c8a89d6be 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -71,8 +71,8 @@ describe('Test users subscriptions', function () {
71 it('User of server 1 should follow user of server 3 and root of server 1', async function () { 71 it('User of server 1 should follow user of server 3 and root of server 1', async function () {
72 this.timeout(60000) 72 this.timeout(60000)
73 73
74 await addUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003') 74 await addUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:' + servers[2].port)
75 await addUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:9001') 75 await addUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:' + servers[0].port)
76 76
77 await waitJobs(servers) 77 await waitJobs(servers)
78 78
@@ -116,22 +116,22 @@ describe('Test users subscriptions', function () {
116 116
117 it('Should get subscription', async function () { 117 it('Should get subscription', async function () {
118 { 118 {
119 const res = await getUserSubscription(servers[ 0 ].url, users[ 0 ].accessToken, 'user3_channel@localhost:9003') 119 const res = await getUserSubscription(servers[ 0 ].url, users[ 0 ].accessToken, 'user3_channel@localhost:' + servers[2].port)
120 const videoChannel: VideoChannel = res.body 120 const videoChannel: VideoChannel = res.body
121 121
122 expect(videoChannel.name).to.equal('user3_channel') 122 expect(videoChannel.name).to.equal('user3_channel')
123 expect(videoChannel.host).to.equal('localhost:9003') 123 expect(videoChannel.host).to.equal('localhost:' + servers[2].port)
124 expect(videoChannel.displayName).to.equal('Main user3 channel') 124 expect(videoChannel.displayName).to.equal('Main user3 channel')
125 expect(videoChannel.followingCount).to.equal(0) 125 expect(videoChannel.followingCount).to.equal(0)
126 expect(videoChannel.followersCount).to.equal(1) 126 expect(videoChannel.followersCount).to.equal(1)
127 } 127 }
128 128
129 { 129 {
130 const res = await getUserSubscription(servers[ 0 ].url, users[ 0 ].accessToken, 'root_channel@localhost:9001') 130 const res = await getUserSubscription(servers[ 0 ].url, users[ 0 ].accessToken, 'root_channel@localhost:' + servers[0].port)
131 const videoChannel: VideoChannel = res.body 131 const videoChannel: VideoChannel = res.body
132 132
133 expect(videoChannel.name).to.equal('root_channel') 133 expect(videoChannel.name).to.equal('root_channel')
134 expect(videoChannel.host).to.equal('localhost:9001') 134 expect(videoChannel.host).to.equal('localhost:' + servers[0].port)
135 expect(videoChannel.displayName).to.equal('Main root channel') 135 expect(videoChannel.displayName).to.equal('Main root channel')
136 expect(videoChannel.followingCount).to.equal(0) 136 expect(videoChannel.followingCount).to.equal(0)
137 expect(videoChannel.followersCount).to.equal(1) 137 expect(videoChannel.followersCount).to.equal(1)
@@ -140,19 +140,19 @@ describe('Test users subscriptions', function () {
140 140
141 it('Should return the existing subscriptions', async function () { 141 it('Should return the existing subscriptions', async function () {
142 const uris = [ 142 const uris = [
143 'user3_channel@localhost:9003', 143 'user3_channel@localhost:' + servers[2].port,
144 'root2_channel@localhost:9001', 144 'root2_channel@localhost:' + servers[0].port,
145 'root_channel@localhost:9001', 145 'root_channel@localhost:' + servers[0].port,
146 'user3_channel@localhost:9001' 146 'user3_channel@localhost:' + servers[0].port
147 ] 147 ]
148 148
149 const res = await areSubscriptionsExist(servers[ 0 ].url, users[ 0 ].accessToken, uris) 149 const res = await areSubscriptionsExist(servers[ 0 ].url, users[ 0 ].accessToken, uris)
150 const body = res.body 150 const body = res.body
151 151
152 expect(body['user3_channel@localhost:9003']).to.be.true 152 expect(body['user3_channel@localhost:' + servers[2].port]).to.be.true
153 expect(body['root2_channel@localhost:9001']).to.be.false 153 expect(body['root2_channel@localhost:' + servers[0].port]).to.be.false
154 expect(body['root_channel@localhost:9001']).to.be.true 154 expect(body['root_channel@localhost:' + servers[0].port]).to.be.true
155 expect(body['user3_channel@localhost:9001']).to.be.false 155 expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false
156 }) 156 })
157 157
158 it('Should list subscription videos', async function () { 158 it('Should list subscription videos', async function () {
@@ -291,7 +291,7 @@ describe('Test users subscriptions', function () {
291 it('Should remove user of server 3 subscription', async function () { 291 it('Should remove user of server 3 subscription', async function () {
292 this.timeout(30000) 292 this.timeout(30000)
293 293
294 await removeUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003') 294 await removeUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:' + servers[2].port)
295 295
296 await waitJobs(servers) 296 await waitJobs(servers)
297 }) 297 })
@@ -312,7 +312,7 @@ describe('Test users subscriptions', function () {
312 it('Should remove the root subscription and not display the videos anymore', async function () { 312 it('Should remove the root subscription and not display the videos anymore', async function () {
313 this.timeout(30000) 313 this.timeout(30000)
314 314
315 await removeUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:9001') 315 await removeUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:' + servers[0].port)
316 316
317 await waitJobs(servers) 317 await waitJobs(servers)
318 318
@@ -340,7 +340,7 @@ describe('Test users subscriptions', function () {
340 it('Should follow user of server 3 again', async function () { 340 it('Should follow user of server 3 again', async function () {
341 this.timeout(60000) 341 this.timeout(60000)
342 342
343 await addUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003') 343 await addUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:' + servers[2].port)
344 344
345 await waitJobs(servers) 345 await waitJobs(servers)
346 346
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 9a971adb3..988fdad3f 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -151,13 +151,13 @@ describe('Test users with multiple servers', function () {
151 for (const server of servers) { 151 for (const server of servers) {
152 const resAccounts = await getAccountsList(server.url, '-createdAt') 152 const resAccounts = await getAccountsList(server.url, '-createdAt')
153 153
154 const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account 154 const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) as Account
155 expect(rootServer1List).not.to.be.undefined 155 expect(rootServer1List).not.to.be.undefined
156 156
157 const resAccount = await getAccount(server.url, rootServer1List.name + '@' + rootServer1List.host) 157 const resAccount = await getAccount(server.url, rootServer1List.name + '@' + rootServer1List.host)
158 const rootServer1Get = resAccount.body as Account 158 const rootServer1Get = resAccount.body as Account
159 expect(rootServer1Get.name).to.equal('root') 159 expect(rootServer1Get.name).to.equal('root')
160 expect(rootServer1Get.host).to.equal('localhost:9001') 160 expect(rootServer1Get.host).to.equal('localhost:' + servers[0].port)
161 expect(rootServer1Get.displayName).to.equal('my super display name') 161 expect(rootServer1Get.displayName).to.equal('my super display name')
162 expect(rootServer1Get.description).to.equal('my super description updated') 162 expect(rootServer1Get.description).to.equal('my super description updated')
163 163
@@ -188,12 +188,12 @@ describe('Test users with multiple servers', function () {
188 for (const server of servers) { 188 for (const server of servers) {
189 const resAccounts = await getAccountsList(server.url, '-createdAt') 189 const resAccounts = await getAccountsList(server.url, '-createdAt')
190 190
191 const accountDeleted = resAccounts.body.data.find(a => a.name === 'user1' && a.host === 'localhost:9001') as Account 191 const accountDeleted = resAccounts.body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) as Account
192 expect(accountDeleted).not.to.be.undefined 192 expect(accountDeleted).not.to.be.undefined
193 193
194 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10) 194 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10)
195 const videoChannelDeleted = resVideoChannels.body.data.find(a => { 195 const videoChannelDeleted = resVideoChannels.body.data.find(a => {
196 return a.displayName === 'Main user1 channel' && a.host === 'localhost:9001' 196 return a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port
197 }) as VideoChannel 197 }) as VideoChannel
198 expect(videoChannelDeleted).not.to.be.undefined 198 expect(videoChannelDeleted).not.to.be.undefined
199 } 199 }
@@ -205,12 +205,12 @@ describe('Test users with multiple servers', function () {
205 for (const server of servers) { 205 for (const server of servers) {
206 const resAccounts = await getAccountsList(server.url, '-createdAt') 206 const resAccounts = await getAccountsList(server.url, '-createdAt')
207 207
208 const accountDeleted = resAccounts.body.data.find(a => a.name === 'user1' && a.host === 'localhost:9001') as Account 208 const accountDeleted = resAccounts.body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) as Account
209 expect(accountDeleted).to.be.undefined 209 expect(accountDeleted).to.be.undefined
210 210
211 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10) 211 const resVideoChannels = await getVideoChannelsList(server.url, 0, 10)
212 const videoChannelDeleted = resVideoChannels.body.data.find(a => { 212 const videoChannelDeleted = resVideoChannels.body.data.find(a => {
213 return a.name === 'Main user1 channel' && a.host === 'localhost:9001' 213 return a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port
214 }) as VideoChannel 214 }) as VideoChannel
215 expect(videoChannelDeleted).to.be.undefined 215 expect(videoChannelDeleted).to.be.undefined
216 } 216 }
@@ -218,14 +218,14 @@ describe('Test users with multiple servers', function () {
218 218
219 it('Should not have actor files', async () => { 219 it('Should not have actor files', async () => {
220 for (const server of servers) { 220 for (const server of servers) {
221 await checkActorFilesWereRemoved(userAccountUUID, server.serverNumber) 221 await checkActorFilesWereRemoved(userAccountUUID, server.internalServerNumber)
222 await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber) 222 await checkActorFilesWereRemoved(userVideoChannelUUID, server.internalServerNumber)
223 } 223 }
224 }) 224 })
225 225
226 it('Should not have video files', async () => { 226 it('Should not have video files', async () => {
227 for (const server of servers) { 227 for (const server of servers) {
228 await checkVideoFilesWereRemoved(videoUUID, server.serverNumber) 228 await checkVideoFilesWereRemoved(videoUUID, server.internalServerNumber)
229 } 229 }
230 }) 230 })
231 231
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index c8e32f3f5..c1a24b838 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -316,7 +316,7 @@ describe('Test users', function () {
316 316
317 const rootUser = users[ 1 ] 317 const rootUser = users[ 1 ]
318 expect(rootUser.username).to.equal('root') 318 expect(rootUser.username).to.equal('root')
319 expect(rootUser.email).to.equal('admin1@example.com') 319 expect(rootUser.email).to.equal('admin' + server.internalServerNumber + '@example.com')
320 expect(user.nsfwPolicy).to.equal('display') 320 expect(user.nsfwPolicy).to.equal('display')
321 321
322 userId = user.id 322 userId = user.id
@@ -334,7 +334,7 @@ describe('Test users', function () {
334 334
335 const user = users[ 0 ] 335 const user = users[ 0 ]
336 expect(user.username).to.equal('root') 336 expect(user.username).to.equal('root')
337 expect(user.email).to.equal('admin1@example.com') 337 expect(user.email).to.equal('admin' + server.internalServerNumber + '@example.com')
338 expect(user.roleLabel).to.equal('Administrator') 338 expect(user.roleLabel).to.equal('Administrator')
339 expect(user.nsfwPolicy).to.equal('display') 339 expect(user.nsfwPolicy).to.equal('display')
340 }) 340 })
@@ -379,7 +379,7 @@ describe('Test users', function () {
379 expect(users.length).to.equal(2) 379 expect(users.length).to.equal(2)
380 380
381 expect(users[ 0 ].username).to.equal('root') 381 expect(users[ 0 ].username).to.equal('root')
382 expect(users[ 0 ].email).to.equal('admin1@example.com') 382 expect(users[ 0 ].email).to.equal('admin' + server.internalServerNumber + '@example.com')
383 expect(users[ 0 ].nsfwPolicy).to.equal('display') 383 expect(users[ 0 ].nsfwPolicy).to.equal('display')
384 384
385 expect(users[ 1 ].username).to.equal('user_1') 385 expect(users[ 1 ].username).to.equal('user_1')