+ it('Should fail with a tag length too big', async function () {
+ const fields = { ...baseCorrectParams, tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] }
+ const attaches = baseCorrectAttaches
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail with a bad schedule update (miss updateAt)', async function () {
+ const fields = { ...baseCorrectParams, scheduleUpdate: { privacy: VideoPrivacy.PUBLIC } }
+ const attaches = baseCorrectAttaches
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail with a bad schedule update (wrong updateAt)', async function () {
+ const fields = {
+ ...baseCorrectParams,
+
+ scheduleUpdate: {
+ privacy: VideoPrivacy.PUBLIC,
+ updateAt: 'toto'
+ }
+ }
+ const attaches = baseCorrectAttaches
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail with a bad originally published at attribute', async function () {
+ const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }
+ const attaches = baseCorrectAttaches
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail without an input file', async function () {
+ const fields = baseCorrectParams
+ const attaches = {}
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail with an incorrect input file', async function () {
+ const fields = baseCorrectParams
+ let attaches = { fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm') }
+
+ await checkUploadVideoParam(
+ server,
+ server.accessToken,
+ { ...fields, ...attaches },
+ HttpStatusCode.UNPROCESSABLE_ENTITY_422,
+ mode
+ )
+
+ attaches = { fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv') }
+ await checkUploadVideoParam(
+ server,
+ server.accessToken,
+ { ...fields, ...attaches },
+ HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415,
+ mode
+ )
+ })
+
+ it('Should fail with an incorrect thumbnail file', async function () {
+ const fields = baseCorrectParams
+ const attaches = {
+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),
+ fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+ }
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail with a big thumbnail file', async function () {
+ const fields = baseCorrectParams
+ const attaches = {
+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'),
+ fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+ }
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
+ })
+
+ it('Should fail with an incorrect preview file', async function () {
+ const fields = baseCorrectParams
+ const attaches = {
+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),
+ fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+ }
+
+ await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)