diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-25 09:57:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-25 10:41:07 +0200 |
commit | ad9e39fb815d85e5e718c40540fa75471474fa17 (patch) | |
tree | 960accb16bca0fac7694b3f3d5d038534b66c224 /server/tests/api/users | |
parent | 06be7ed0b27b371465c5d1b7f92b4adfb0b866ea (diff) | |
download | PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.gz PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.zst PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.zip |
Only use account name in routes
Diffstat (limited to 'server/tests/api/users')
-rw-r--r-- | server/tests/api/users/users-multiple-servers.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 8b9b63348..0e1e6c97d 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts | |||
@@ -26,7 +26,7 @@ const expect = chai.expect | |||
26 | describe('Test users with multiple servers', function () { | 26 | describe('Test users with multiple servers', function () { |
27 | let servers: ServerInfo[] = [] | 27 | let servers: ServerInfo[] = [] |
28 | let user: User | 28 | let user: User |
29 | let userAccountUUID: string | 29 | let userAccountName: string |
30 | let userVideoChannelUUID: string | 30 | let userVideoChannelUUID: string |
31 | let userId: number | 31 | let userId: number |
32 | let videoUUID: string | 32 | let videoUUID: string |
@@ -56,13 +56,16 @@ describe('Test users with multiple servers', function () { | |||
56 | password: 'password' | 56 | password: 'password' |
57 | } | 57 | } |
58 | const res = await createUser(servers[ 0 ].url, servers[ 0 ].accessToken, user.username, user.password) | 58 | const res = await createUser(servers[ 0 ].url, servers[ 0 ].accessToken, user.username, user.password) |
59 | userAccountUUID = res.body.user.account.uuid | ||
60 | userId = res.body.user.id | 59 | userId = res.body.user.id |
61 | |||
62 | userAccessToken = await userLogin(servers[ 0 ], user) | 60 | userAccessToken = await userLogin(servers[ 0 ], user) |
63 | } | 61 | } |
64 | 62 | ||
65 | { | 63 | { |
64 | const res = await getMyUserInformation(servers[0].url, userAccessToken) | ||
65 | userAccountName = res.body.account.name + '@' + res.body.account.host | ||
66 | } | ||
67 | |||
68 | { | ||
66 | const res = await getMyUserInformation(servers[ 0 ].url, servers[ 0 ].accessToken) | 69 | const res = await getMyUserInformation(servers[ 0 ].url, servers[ 0 ].accessToken) |
67 | const user: User = res.body | 70 | const user: User = res.body |
68 | userVideoChannelUUID = user.videoChannels[0].uuid | 71 | userVideoChannelUUID = user.videoChannels[0].uuid |
@@ -135,7 +138,7 @@ describe('Test users with multiple servers', function () { | |||
135 | const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account | 138 | const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account |
136 | expect(rootServer1List).not.to.be.undefined | 139 | expect(rootServer1List).not.to.be.undefined |
137 | 140 | ||
138 | const resAccount = await getAccount(server.url, rootServer1List.id) | 141 | const resAccount = await getAccount(server.url, rootServer1List.name + '@' + rootServer1List.host) |
139 | const rootServer1Get = resAccount.body as Account | 142 | const rootServer1Get = resAccount.body as Account |
140 | expect(rootServer1Get.name).to.equal('root') | 143 | expect(rootServer1Get.name).to.equal('root') |
141 | expect(rootServer1Get.host).to.equal('localhost:9001') | 144 | expect(rootServer1Get.host).to.equal('localhost:9001') |
@@ -148,7 +151,7 @@ describe('Test users with multiple servers', function () { | |||
148 | 151 | ||
149 | it('Should list account videos', async function () { | 152 | it('Should list account videos', async function () { |
150 | for (const server of servers) { | 153 | for (const server of servers) { |
151 | const res = await getAccountVideos(server.url, server.accessToken, userAccountUUID, 0, 5) | 154 | const res = await getAccountVideos(server.url, server.accessToken, userAccountName, 0, 5) |
152 | 155 | ||
153 | expect(res.body.total).to.equal(1) | 156 | expect(res.body.total).to.equal(1) |
154 | expect(res.body.data).to.be.an('array') | 157 | expect(res.body.data).to.be.an('array') |
@@ -193,7 +196,7 @@ describe('Test users with multiple servers', function () { | |||
193 | 196 | ||
194 | it('Should not have actor files', async () => { | 197 | it('Should not have actor files', async () => { |
195 | for (const server of servers) { | 198 | for (const server of servers) { |
196 | await checkActorFilesWereRemoved(userAccountUUID, server.serverNumber) | 199 | await checkActorFilesWereRemoved(userAccountName, server.serverNumber) |
197 | await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber) | 200 | await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber) |
198 | } | 201 | } |
199 | }) | 202 | }) |