+ const fields = immutableAssign(baseCorrectParams, { email: 'admin' + server.internalServerNumber + '@example.com' })
+
+ await makePostBodyRequest({
+ url: server.url,
+ path: registrationPath,
+ token: server.accessToken,
+ fields,
+ statusCodeExpected: HttpStatusCode.CONFLICT_409
+ })
+ })
+
+ 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' } })
+
+ await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
+ })
+
+ it('Should fail with a bad channel display name', async function () {
+ const fields = immutableAssign(baseCorrectParams, { channel: { name: 'toto', displayName: '' } })
+
+ await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
+ })
+
+ it('Should fail with a channel name that is the same as username', async function () {
+ const source = { username: 'super_user', channel: { name: 'super_user', displayName: 'display name' } }
+ const fields = immutableAssign(baseCorrectParams, source)
+
+ await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
+ })
+
+ it('Should fail with an existing channel', async function () {
+ const videoChannelAttributesArg = { name: 'existing_channel', displayName: 'hello', description: 'super description' }
+ await addVideoChannel(server.url, server.accessToken, videoChannelAttributesArg)
+
+ const fields = immutableAssign(baseCorrectParams, { channel: { name: 'existing_channel', displayName: 'toto' } })