From 1f20622f2b087eaf8738d60fae00a44b9c558ca3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Jun 2019 16:59:53 +0200 Subject: 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 --- server/tests/api/check-params/users.ts | 7 +++++++ server/tests/api/users/users.ts | 15 +++++++++++---- server/tests/api/videos/video-playlists.ts | 1 - 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'server/tests/api') 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 () { const registrationPath = path + '/register' const baseCorrectParams = { username: 'user3', + displayName: 'super user', email: 'test3@example.com', password: 'my super password' } @@ -725,6 +726,12 @@ describe('Test users API validators', function () { }) }) + it('Should fail with a bad display name', async function () { + const fields = immutableAssign(baseCorrectParams, { displayName: 'a'.repeat(150) }) + + await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields }) + }) + it('Should fail with a bad channel name', async function () { const fields = immutableAssign(baseCorrectParams, { channel: { name: '[]azf', displayName: 'toto' } }) 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 { getUserInformation, getUsersList, getUsersListPaginationAndSort, + getVideoChannel, getVideosList, login, makePutBodyRequest, rateVideo, - registerUser, + registerUserWithChannel, removeUser, removeVideo, ServerInfo, @@ -31,8 +32,7 @@ import { updateMyUser, updateUser, uploadVideo, - userLogin, - registerUserWithChannel, getVideoChannel + userLogin } from '../../../../shared/extra-utils' import { follow } from '../../../../shared/extra-utils/server/follows' import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' @@ -618,7 +618,7 @@ describe('Test users', function () { describe('Registering a new user', function () { it('Should register a new user', async function () { - const user = { username: 'user_15', password: 'my super password' } + const user = { displayName: 'super user 15', 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 }) @@ -633,6 +633,13 @@ describe('Test users', function () { accessToken = await userLogin(server, user15) }) + it('Should have the correct display name', async function () { + const res = await getMyUserInformation(server.url, accessToken) + const user: User = res.body + + expect(user.account.displayName).to.equal('super user 15') + }) + it('Should have the correct video quota', async function () { const res = await getMyUserInformation(server.url, accessToken) 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 () { } }) - it('Should be able to create a public playlist, and set it to private', async function () { this.timeout(30000) -- cgit v1.2.3