+ describe('When updating video channel avatar/banner', function () {
+ const types = [ 'avatar', 'banner' ]
+ let path: string
+
+ before(async function () {
+ path = videoChannelPath + '/super_channel'
+ })
+
+ it('Should fail with an incorrect input file', async function () {
+ for (const type of types) {
+ const fields = {}
+ const attaches = {
+ [type + 'file']: buildAbsoluteFixturePath('video_short.mp4')
+ }
+
+ await makeUploadRequest({ url: server.url, path: `${path}/${type}/pick`, token: server.accessToken, fields, attaches })
+ }
+ })
+
+ it('Should fail with a big file', async function () {
+ for (const type of types) {
+ const fields = {}
+ const attaches = {
+ [type + 'file']: buildAbsoluteFixturePath('avatar-big.png')
+ }
+ await makeUploadRequest({ url: server.url, path: `${path}/${type}/pick`, token: server.accessToken, fields, attaches })
+ }
+ })
+
+ it('Should fail with an unauthenticated user', async function () {
+ for (const type of types) {
+ const fields = {}
+ const attaches = {
+ [type + 'file']: buildAbsoluteFixturePath('avatar.png')
+ }
+ await makeUploadRequest({
+ url: server.url,
+ path: `${path}/${type}/pick`,
+ fields,
+ attaches,
+ statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
+ })
+ }
+ })
+
+ it('Should succeed with the correct params', async function () {
+ for (const type of types) {
+ const fields = {}
+ const attaches = {
+ [type + 'file']: buildAbsoluteFixturePath('avatar.png')
+ }
+ await makeUploadRequest({
+ url: server.url,
+ path: `${path}/${type}/pick`,
+ token: server.accessToken,
+ fields,
+ attaches,
+ statusCodeExpected: HttpStatusCode.OK_200
+ })
+ }
+ })
+ })
+