aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-07 16:59:53 +0200
committerChocobozzz <me@florianbigard.com>2019-06-07 17:05:42 +0200
commit1f20622f2b087eaf8738d60fae00a44b9c558ca3 (patch)
tree1c8554623665ca96b8a1e6f2a6bcb8c1b5a83c2e /server/tests
parent1a03bea0c42fa1064ce4770157b4fd2e3edd5565 (diff)
downloadPeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.tar.gz
PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.tar.zst
PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.zip
Improve registration
* Add ability to set the user display name * Use display name to guess the username/channel name * Add explanations about what is the purpose of a username/channel name * Add a loader at the "done" step
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/users.ts7
-rw-r--r--server/tests/api/users/users.ts15
-rw-r--r--server/tests/api/videos/video-playlists.ts1
3 files changed, 18 insertions, 5 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 95097817b..3268f8c90 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -643,6 +643,7 @@ describe('Test users API validators', function () {
643 const registrationPath = path + '/register' 643 const registrationPath = path + '/register'
644 const baseCorrectParams = { 644 const baseCorrectParams = {
645 username: 'user3', 645 username: 'user3',
646 displayName: 'super user',
646 email: 'test3@example.com', 647 email: 'test3@example.com',
647 password: 'my super password' 648 password: 'my super password'
648 } 649 }
@@ -725,6 +726,12 @@ describe('Test users API validators', function () {
725 }) 726 })
726 }) 727 })
727 728
729 it('Should fail with a bad display name', async function () {
730 const fields = immutableAssign(baseCorrectParams, { displayName: 'a'.repeat(150) })
731
732 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
733 })
734
728 it('Should fail with a bad channel name', async function () { 735 it('Should fail with a bad channel name', async function () {
729 const fields = immutableAssign(baseCorrectParams, { channel: { name: '[]azf', displayName: 'toto' } }) 736 const fields = immutableAssign(baseCorrectParams, { channel: { name: '[]azf', displayName: 'toto' } })
730 737
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 9d2ef786f..b1f214fe2 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -17,11 +17,12 @@ import {
17 getUserInformation, 17 getUserInformation,
18 getUsersList, 18 getUsersList,
19 getUsersListPaginationAndSort, 19 getUsersListPaginationAndSort,
20 getVideoChannel,
20 getVideosList, 21 getVideosList,
21 login, 22 login,
22 makePutBodyRequest, 23 makePutBodyRequest,
23 rateVideo, 24 rateVideo,
24 registerUser, 25 registerUserWithChannel,
25 removeUser, 26 removeUser,
26 removeVideo, 27 removeVideo,
27 ServerInfo, 28 ServerInfo,
@@ -31,8 +32,7 @@ import {
31 updateMyUser, 32 updateMyUser,
32 updateUser, 33 updateUser,
33 uploadVideo, 34 uploadVideo,
34 userLogin, 35 userLogin
35 registerUserWithChannel, getVideoChannel
36} from '../../../../shared/extra-utils' 36} from '../../../../shared/extra-utils'
37import { follow } from '../../../../shared/extra-utils/server/follows' 37import { follow } from '../../../../shared/extra-utils/server/follows'
38import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' 38import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
@@ -618,7 +618,7 @@ describe('Test users', function () {
618 618
619 describe('Registering a new user', function () { 619 describe('Registering a new user', function () {
620 it('Should register a new user', async function () { 620 it('Should register a new user', async function () {
621 const user = { username: 'user_15', password: 'my super password' } 621 const user = { displayName: 'super user 15', username: 'user_15', password: 'my super password' }
622 const channel = { name: 'my_user_15_channel', displayName: 'my channel rocks' } 622 const channel = { name: 'my_user_15_channel', displayName: 'my channel rocks' }
623 623
624 await registerUserWithChannel({ url: server.url, user, channel }) 624 await registerUserWithChannel({ url: server.url, user, channel })
@@ -633,6 +633,13 @@ describe('Test users', function () {
633 accessToken = await userLogin(server, user15) 633 accessToken = await userLogin(server, user15)
634 }) 634 })
635 635
636 it('Should have the correct display name', async function () {
637 const res = await getMyUserInformation(server.url, accessToken)
638 const user: User = res.body
639
640 expect(user.account.displayName).to.equal('super user 15')
641 })
642
636 it('Should have the correct video quota', async function () { 643 it('Should have the correct video quota', async function () {
637 const res = await getMyUserInformation(server.url, accessToken) 644 const res = await getMyUserInformation(server.url, accessToken)
638 const user = res.body 645 const user = res.body
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 8690327c4..f82c8cbce 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -754,7 +754,6 @@ describe('Test video playlists', function () {
754 } 754 }
755 }) 755 })
756 756
757
758 it('Should be able to create a public playlist, and set it to private', async function () { 757 it('Should be able to create a public playlist, and set it to private', async function () {
759 this.timeout(30000) 758 this.timeout(30000)
760 759