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.ts38
-rw-r--r--server/tests/api/users/users-multiple-servers.ts16
-rw-r--r--server/tests/api/users/users-verification.ts2
3 files changed, 28 insertions, 28 deletions
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index fbeca7d67..b45cfe67e 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -63,8 +63,8 @@ describe('Test users subscriptions', function () {
63 it('User of server 1 should follow user of server 3 and root of server 1', async function () { 63 it('User of server 1 should follow user of server 3 and root of server 1', async function () {
64 this.timeout(60000) 64 this.timeout(60000)
65 65
66 await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) 66 await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })
67 await command.add({ token: users[0].accessToken, targetUri: 'root_channel@localhost:' + servers[0].port }) 67 await command.add({ token: users[0].accessToken, targetUri: 'root_channel@' + servers[0].host })
68 68
69 await waitJobs(servers) 69 await waitJobs(servers)
70 70
@@ -112,20 +112,20 @@ describe('Test users subscriptions', function () {
112 112
113 it('Should get subscription', async function () { 113 it('Should get subscription', async function () {
114 { 114 {
115 const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port }) 115 const videoChannel = await command.get({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })
116 116
117 expect(videoChannel.name).to.equal('user3_channel') 117 expect(videoChannel.name).to.equal('user3_channel')
118 expect(videoChannel.host).to.equal('localhost:' + servers[2].port) 118 expect(videoChannel.host).to.equal(servers[2].host)
119 expect(videoChannel.displayName).to.equal('Main user3 channel') 119 expect(videoChannel.displayName).to.equal('Main user3 channel')
120 expect(videoChannel.followingCount).to.equal(0) 120 expect(videoChannel.followingCount).to.equal(0)
121 expect(videoChannel.followersCount).to.equal(1) 121 expect(videoChannel.followersCount).to.equal(1)
122 } 122 }
123 123
124 { 124 {
125 const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port }) 125 const videoChannel = await command.get({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })
126 126
127 expect(videoChannel.name).to.equal('root_channel') 127 expect(videoChannel.name).to.equal('root_channel')
128 expect(videoChannel.host).to.equal('localhost:' + servers[0].port) 128 expect(videoChannel.host).to.equal(servers[0].host)
129 expect(videoChannel.displayName).to.equal('Main root channel') 129 expect(videoChannel.displayName).to.equal('Main root channel')
130 expect(videoChannel.followingCount).to.equal(0) 130 expect(videoChannel.followingCount).to.equal(0)
131 expect(videoChannel.followersCount).to.equal(1) 131 expect(videoChannel.followersCount).to.equal(1)
@@ -134,18 +134,18 @@ describe('Test users subscriptions', function () {
134 134
135 it('Should return the existing subscriptions', async function () { 135 it('Should return the existing subscriptions', async function () {
136 const uris = [ 136 const uris = [
137 'user3_channel@localhost:' + servers[2].port, 137 'user3_channel@' + servers[2].host,
138 'root2_channel@localhost:' + servers[0].port, 138 'root2_channel@' + servers[0].host,
139 'root_channel@localhost:' + servers[0].port, 139 'root_channel@' + servers[0].host,
140 'user3_channel@localhost:' + servers[0].port 140 'user3_channel@' + servers[0].host
141 ] 141 ]
142 142
143 const body = await command.exist({ token: users[0].accessToken, uris }) 143 const body = await command.exist({ token: users[0].accessToken, uris })
144 144
145 expect(body['user3_channel@localhost:' + servers[2].port]).to.be.true 145 expect(body['user3_channel@' + servers[2].host]).to.be.true
146 expect(body['root2_channel@localhost:' + servers[0].port]).to.be.false 146 expect(body['root2_channel@' + servers[0].host]).to.be.false
147 expect(body['root_channel@localhost:' + servers[0].port]).to.be.true 147 expect(body['root_channel@' + servers[0].host]).to.be.true
148 expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false 148 expect(body['user3_channel@' + servers[0].host]).to.be.false
149 }) 149 })
150 150
151 it('Should search among subscriptions', async function () { 151 it('Should search among subscriptions', async function () {
@@ -305,7 +305,7 @@ describe('Test users subscriptions', function () {
305 it('Should remove user of server 3 subscription', async function () { 305 it('Should remove user of server 3 subscription', async function () {
306 this.timeout(30000) 306 this.timeout(30000)
307 307
308 await command.remove({ token: users[0].accessToken, uri: 'user3_channel@localhost:' + servers[2].port }) 308 await command.remove({ token: users[0].accessToken, uri: 'user3_channel@' + servers[2].host })
309 309
310 await waitJobs(servers) 310 await waitJobs(servers)
311 }) 311 })
@@ -324,7 +324,7 @@ describe('Test users subscriptions', function () {
324 it('Should remove the root subscription and not display the videos anymore', async function () { 324 it('Should remove the root subscription and not display the videos anymore', async function () {
325 this.timeout(30000) 325 this.timeout(30000)
326 326
327 await command.remove({ token: users[0].accessToken, uri: 'root_channel@localhost:' + servers[0].port }) 327 await command.remove({ token: users[0].accessToken, uri: 'root_channel@' + servers[0].host })
328 328
329 await waitJobs(servers) 329 await waitJobs(servers)
330 330
@@ -355,7 +355,7 @@ describe('Test users subscriptions', function () {
355 it('Should follow user of server 3 again', async function () { 355 it('Should follow user of server 3 again', async function () {
356 this.timeout(60000) 356 this.timeout(60000)
357 357
358 await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) 358 await command.add({ token: users[0].accessToken, targetUri: 'user3_channel@' + servers[2].host })
359 359
360 await waitJobs(servers) 360 await waitJobs(servers)
361 361
@@ -389,8 +389,8 @@ describe('Test users subscriptions', function () {
389 389
390 await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } }) 390 await servers[2].channels.create({ token: users[2].accessToken, attributes: { name: 'user3_channel2' } })
391 391
392 await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@localhost:' + servers[2].port }) 392 await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel@' + servers[2].host })
393 await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@localhost:' + servers[2].port }) 393 await servers[2].subscriptions.add({ token: servers[2].accessToken, targetUri: 'user3_channel2@' + servers[2].host })
394 394
395 await waitJobs(servers) 395 await waitJobs(servers)
396 }) 396 })
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 188e6f137..f94191b04 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -111,7 +111,7 @@ describe('Test users with multiple servers', function () {
111 for (const server of servers) { 111 for (const server of servers) {
112 const body = await server.accounts.list({ sort: '-createdAt' }) 112 const body = await server.accounts.list({ sort: '-createdAt' })
113 113
114 const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port) 114 const resList = body.data.find(a => a.name === 'root' && a.host === servers[0].host)
115 expect(resList).not.to.be.undefined 115 expect(resList).not.to.be.undefined
116 116
117 const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host }) 117 const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host })
@@ -119,7 +119,7 @@ describe('Test users with multiple servers', function () {
119 if (!createdAt) createdAt = account.createdAt 119 if (!createdAt) createdAt = account.createdAt
120 120
121 expect(account.name).to.equal('root') 121 expect(account.name).to.equal('root')
122 expect(account.host).to.equal('localhost:' + servers[0].port) 122 expect(account.host).to.equal(servers[0].host)
123 expect(account.displayName).to.equal('my super display name') 123 expect(account.displayName).to.equal('my super display name')
124 expect(account.description).to.equal('my super description updated') 124 expect(account.description).to.equal('my super description updated')
125 expect(createdAt).to.equal(account.createdAt) 125 expect(createdAt).to.equal(account.createdAt)
@@ -138,7 +138,7 @@ describe('Test users with multiple servers', function () {
138 138
139 it('Should list account videos', async function () { 139 it('Should list account videos', async function () {
140 for (const server of servers) { 140 for (const server of servers) {
141 const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port }) 141 const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host })
142 142
143 expect(total).to.equal(1) 143 expect(total).to.equal(1)
144 expect(data).to.be.an('array') 144 expect(data).to.be.an('array')
@@ -155,7 +155,7 @@ describe('Test users with multiple servers', function () {
155 await waitJobs(servers) 155 await waitJobs(servers)
156 156
157 for (const server of servers) { 157 for (const server of servers) {
158 const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port, search: 'Kami' }) 158 const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host, search: 'Kami' })
159 159
160 expect(total).to.equal(1) 160 expect(total).to.equal(1)
161 expect(data).to.be.an('array') 161 expect(data).to.be.an('array')
@@ -170,11 +170,11 @@ describe('Test users with multiple servers', function () {
170 for (const server of servers) { 170 for (const server of servers) {
171 const body = await server.accounts.list({ sort: '-createdAt' }) 171 const body = await server.accounts.list({ sort: '-createdAt' })
172 172
173 const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) 173 const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)
174 expect(accountDeleted).not.to.be.undefined 174 expect(accountDeleted).not.to.be.undefined
175 175
176 const { data } = await server.channels.list() 176 const { data } = await server.channels.list()
177 const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) 177 const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === servers[0].host)
178 expect(videoChannelDeleted).not.to.be.undefined 178 expect(videoChannelDeleted).not.to.be.undefined
179 } 179 }
180 180
@@ -185,11 +185,11 @@ describe('Test users with multiple servers', function () {
185 for (const server of servers) { 185 for (const server of servers) {
186 const body = await server.accounts.list({ sort: '-createdAt' }) 186 const body = await server.accounts.list({ sort: '-createdAt' })
187 187
188 const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port) 188 const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)
189 expect(accountDeleted).to.be.undefined 189 expect(accountDeleted).to.be.undefined
190 190
191 const { data } = await server.channels.list() 191 const { data } = await server.channels.list()
192 const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port) 192 const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === servers[0].host)
193 expect(videoChannelDeleted).to.be.undefined 193 expect(videoChannelDeleted).to.be.undefined
194 } 194 }
195 }) 195 })
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index fc082383a..19a8df9e1 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -28,7 +28,7 @@ describe('Test users account verification', function () {
28 28
29 const overrideConfig = { 29 const overrideConfig = {
30 smtp: { 30 smtp: {
31 hostname: 'localhost', 31 hostname: '127.0.0.1',
32 port 32 port
33 } 33 }
34 } 34 }