]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/users/users.ts
Merge branch 'release/v1.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / users / users.ts
index e7291740ba596e117bb52b68c0859cad0a24b6f3..9d2ef786f1da14303ce6f43fd6ca3146f81053d3 100644 (file)
@@ -2,7 +2,7 @@
 
 import * as chai from 'chai'
 import 'mocha'
-import { User, UserRole } from '../../../../shared/index'
+import { User, UserRole, Video } from '../../../../shared/index'
 import {
   blockUser,
   cleanupTests,
@@ -31,7 +31,8 @@ import {
   updateMyUser,
   updateUser,
   uploadVideo,
-  userLogin
+  userLogin,
+  registerUserWithChannel, getVideoChannel
 } from '../../../../shared/extra-utils'
 import { follow } from '../../../../shared/extra-utils/server/follows'
 import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
@@ -290,7 +291,10 @@ describe('Test users', function () {
       const videos = res.body.data
       expect(videos).to.have.lengthOf(1)
 
-      expect(videos[ 0 ].name).to.equal('super user video')
+      const video: Video = videos[ 0 ]
+      expect(video.name).to.equal('super user video')
+      expect(video.thumbnailPath).to.not.be.null
+      expect(video.previewPath).to.not.be.null
     })
   })
 
@@ -313,7 +317,7 @@ describe('Test users', function () {
 
       const rootUser = users[ 1 ]
       expect(rootUser.username).to.equal('root')
-      expect(rootUser.email).to.equal('admin1@example.com')
+      expect(rootUser.email).to.equal('admin' + server.internalServerNumber + '@example.com')
       expect(user.nsfwPolicy).to.equal('display')
 
       userId = user.id
@@ -331,7 +335,7 @@ describe('Test users', function () {
 
       const user = users[ 0 ]
       expect(user.username).to.equal('root')
-      expect(user.email).to.equal('admin1@example.com')
+      expect(user.email).to.equal('admin' + server.internalServerNumber + '@example.com')
       expect(user.roleLabel).to.equal('Administrator')
       expect(user.nsfwPolicy).to.equal('display')
     })
@@ -376,7 +380,7 @@ describe('Test users', function () {
       expect(users.length).to.equal(2)
 
       expect(users[ 0 ].username).to.equal('root')
-      expect(users[ 0 ].email).to.equal('admin1@example.com')
+      expect(users[ 0 ].email).to.equal('admin' + server.internalServerNumber + '@example.com')
       expect(users[ 0 ].nsfwPolicy).to.equal('display')
 
       expect(users[ 1 ].username).to.equal('user_1')
@@ -614,7 +618,10 @@ describe('Test users', function () {
 
   describe('Registering a new user', function () {
     it('Should register a new user', async function () {
-      await registerUser(server.url, 'user_15', 'my super password')
+      const user = { username: 'user_15', password: 'my super password' }
+      const channel = { name: 'my_user_15_channel', displayName: 'my channel rocks' }
+
+      await registerUserWithChannel({ url: server.url, user, channel })
     })
 
     it('Should be able to login with this registered user', async function () {
@@ -633,6 +640,12 @@ describe('Test users', function () {
       expect(user.videoQuota).to.equal(5 * 1024 * 1024)
     })
 
+    it('Should have created the channel', async function () {
+      const res = await getVideoChannel(server.url, 'my_user_15_channel')
+
+      expect(res.body.displayName).to.equal('my channel rocks')
+    })
+
     it('Should remove me', async function () {
       {
         const res = await getUsersList(server.url, server.accessToken)