]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/users/users-multiple-servers.ts
Handle theater mode for playlists
[github/Chocobozzz/PeerTube.git] / server / tests / api / users / users-multiple-servers.ts
index 81489021bfbe44560d463bdefca036af5539855d..006d6cdf0e17da82d395e476bac0bb935620bd15 100644 (file)
@@ -12,15 +12,14 @@ import {
   getVideoChannelsList,
   removeUser,
   updateMyUser,
-  userLogin,
-  wait
-} from '../../utils'
-import { flushTests, getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../utils/index'
-import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../utils/users/accounts'
-import { setAccessTokensToServers } from '../../utils/users/login'
+  userLogin
+} from '../../../../shared/utils'
+import { getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../../../shared/utils/index'
+import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../../../shared/utils/users/accounts'
+import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
 import { User } from '../../../../shared/models/users'
 import { VideoChannel } from '../../../../shared/models/videos'
-import { waitJobs } from '../../utils/server/jobs'
+import { waitJobs } from '../../../../shared/utils/server/jobs'
 
 const expect = chai.expect
 
@@ -28,6 +27,7 @@ describe('Test users with multiple servers', function () {
   let servers: ServerInfo[] = []
   let user: User
   let userAccountName: string
+  let userAccountUUID: string
   let userVideoChannelUUID: string
   let userId: number
   let videoUUID: string
@@ -63,7 +63,9 @@ describe('Test users with multiple servers', function () {
 
     {
       const res = await getMyUserInformation(servers[0].url, userAccessToken)
-      userAccountName = res.body.account.name + '@' + res.body.account.host
+      const account: Account = res.body.account
+      userAccountName = account.name + '@' + account.host
+      userAccountUUID = account.uuid
     }
 
     {
@@ -146,6 +148,12 @@ describe('Test users with multiple servers', function () {
       expect(rootServer1Get.displayName).to.equal('my super display name')
       expect(rootServer1Get.description).to.equal('my super description updated')
 
+      if (server.serverNumber === 1) {
+        expect(rootServer1Get.userId).to.be.a('number')
+      } else {
+        expect(rootServer1Get.userId).to.be.undefined
+      }
+
       await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png')
     }
   })
@@ -172,7 +180,7 @@ describe('Test users with multiple servers', function () {
 
       const resVideoChannels = await getVideoChannelsList(server.url, 0, 10)
       const videoChannelDeleted = resVideoChannels.body.data.find(a => {
-        return a.displayName === 'Default user1 channel' && a.host === 'localhost:9001'
+        return a.displayName === 'Main user1 channel' && a.host === 'localhost:9001'
       }) as VideoChannel
       expect(videoChannelDeleted).not.to.be.undefined
     }
@@ -189,7 +197,7 @@ describe('Test users with multiple servers', function () {
 
       const resVideoChannels = await getVideoChannelsList(server.url, 0, 10)
       const videoChannelDeleted = resVideoChannels.body.data.find(a => {
-        return a.name === 'Default user1 channel' && a.host === 'localhost:9001'
+        return a.name === 'Main user1 channel' && a.host === 'localhost:9001'
       }) as VideoChannel
       expect(videoChannelDeleted).to.be.undefined
     }
@@ -197,7 +205,7 @@ describe('Test users with multiple servers', function () {
 
   it('Should not have actor files', async () => {
     for (const server of servers) {
-      await checkActorFilesWereRemoved(userAccountName, server.serverNumber)
+      await checkActorFilesWereRemoved(userAccountUUID, server.serverNumber)
       await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber)
     }
   })