X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideos.ts;h=904d2287090b12dc3859c4779541d99b1d3ce80a;hb=f6eebcb336c067e160a62020a5140d8d992ba384;hp=04bed3b441be808f74f022b0183a48c622246852;hpb=2186386cca113506791583cb07d6ccacba7af4e0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 04bed3b44..904d22870 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -20,7 +20,7 @@ describe('Test videos API validator', function () { let userAccessToken = '' let accountName: string let channelId: number - let channelUUID: string + let channelName: string let videoId // --------------------------------------------------------------- @@ -42,7 +42,7 @@ describe('Test videos API validator', function () { { const res = await getMyUserInformation(server.url, server.accessToken) channelId = res.body.videoChannels[ 0 ].id - channelUUID = res.body.videoChannels[ 0 ].uuid + channelName = res.body.videoChannels[ 0 ].name accountName = res.body.account.name + '@' + res.body.account.host } }) @@ -140,7 +140,7 @@ describe('Test videos API validator', function () { let path: string before(async function () { - path = '/api/v1/video-channels/' + channelUUID + '/videos' + path = '/api/v1/video-channels/' + channelName + '/videos' }) it('Should fail with a bad start pagination', async function () { @@ -291,6 +291,23 @@ describe('Test videos API validator', function () { await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) }) + it('Should fail with a bad schedule update (miss updateAt)', async function () { + const fields = immutableAssign(baseCorrectParams, { 'scheduleUpdate[privacy]': VideoPrivacy.PUBLIC }) + const attaches = baseCorrectAttaches + + await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) + }) + + it('Should fail with a bad schedule update (wrong updateAt)', async function () { + const fields = immutableAssign(baseCorrectParams, { + 'scheduleUpdate[privacy]': VideoPrivacy.PUBLIC, + 'scheduleUpdate[updateAt]': 'toto' + }) + const attaches = baseCorrectAttaches + + await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) + }) + it('Should fail without an input file', async function () { const fields = baseCorrectParams const attaches = {} @@ -309,7 +326,7 @@ describe('Test videos API validator', function () { const fields = baseCorrectParams const attaches = { 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), - 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -319,7 +336,7 @@ describe('Test videos API validator', function () { const fields = baseCorrectParams const attaches = { 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), - 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -329,7 +346,7 @@ describe('Test videos API validator', function () { const fields = baseCorrectParams const attaches = { 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), - 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -339,7 +356,7 @@ describe('Test videos API validator', function () { const fields = baseCorrectParams const attaches = { 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), - 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') + 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -494,6 +511,18 @@ describe('Test videos API validator', function () { await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) }) + it('Should fail with a bad schedule update (miss updateAt)', async function () { + const fields = immutableAssign(baseCorrectParams, { scheduleUpdate: { privacy: VideoPrivacy.PUBLIC } }) + + await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) + }) + + it('Should fail with a bad schedule update (wrong updateAt)', async function () { + const fields = immutableAssign(baseCorrectParams, { scheduleUpdate: { updateAt: 'toto', privacy: VideoPrivacy.PUBLIC } }) + + await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) + }) + it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = {