Fix tests

pull/3383/head
Chocobozzz 2021-01-26 11:37:31 +01:00
parent ddb62a85c5
commit e9cb361cf5
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
6 changed files with 25 additions and 19 deletions

View File

@ -274,8 +274,6 @@ const CONSTRAINTS_FIELDS = {
DURATION: { min: 0 }, // Number DURATION: { min: 0 }, // Number
TAGS: { min: 0, max: 5 }, // Number of total tags TAGS: { min: 0, max: 5 }, // Number of total tags
TAG: { min: 2, max: 30 }, // Length TAG: { min: 2, max: 30 }, // Length
THUMBNAIL: { min: 2, max: 30 },
THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes
VIEWS: { min: 0 }, VIEWS: { min: 0 },
LIKES: { min: 0 }, LIKES: { min: 0 },
DISLIKES: { min: 0 }, DISLIKES: { min: 0 },
@ -750,6 +748,7 @@ if (isTestInstance() === true) {
ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max = 400 * 1024 // 400KB
SCHEDULER_INTERVALS_MS.actorFollowScores = 1000 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000
SCHEDULER_INTERVALS_MS.removeOldJobs = 10000 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000

View File

@ -180,7 +180,7 @@ describe('Test video lives API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () { it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@ -189,7 +189,7 @@ describe('Test video lives API validator', function () {
it('Should fail with a big thumbnail file', async function () { it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@ -198,7 +198,7 @@ describe('Test video lives API validator', function () {
it('Should fail with an incorrect preview file', async function () { it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@ -207,7 +207,7 @@ describe('Test video lives API validator', function () {
it('Should fail with a big preview file', async function () { it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })

View File

@ -201,7 +201,7 @@ describe('Test video imports API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () { it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@ -210,7 +210,7 @@ describe('Test video imports API validator', function () {
it('Should fail with a big thumbnail file', async function () { it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@ -219,7 +219,7 @@ describe('Test video imports API validator', function () {
it('Should fail with an incorrect preview file', async function () { it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })
@ -228,7 +228,7 @@ describe('Test video imports API validator', function () {
it('Should fail with a big preview file', async function () { it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png')
} }
await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })

View File

@ -251,7 +251,14 @@ describe('Test video playlists API validator', function () {
}) })
it('Should fail with an incorrect thumbnail file', async function () { it('Should fail with an incorrect thumbnail file', async function () {
const params = getBase({ thumbnailfile: 'avatar.png' }) const params = getBase({ thumbnailfile: 'video_short.mp4' })
await createVideoPlaylist(params)
await updateVideoPlaylist(getUpdate(params, playlistUUID))
})
it('Should fail with a thumbnail file too big', async function () {
const params = getBase({ thumbnailfile: 'preview-big.png' })
await createVideoPlaylist(params) await createVideoPlaylist(params)
await updateVideoPlaylist(getUpdate(params, playlistUUID)) await updateVideoPlaylist(getUpdate(params, playlistUUID))

View File

@ -373,7 +373,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () { it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),
videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
} }
@ -383,7 +383,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big thumbnail file', async function () { it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'),
videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
} }
@ -393,7 +393,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect preview file', async function () { it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),
videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
} }
@ -403,7 +403,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big preview file', async function () { it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'),
videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
} }
@ -581,7 +581,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () { it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
} }
await makeUploadRequest({ await makeUploadRequest({
@ -597,7 +597,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big thumbnail file', async function () { it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png')
} }
await makeUploadRequest({ await makeUploadRequest({
@ -613,7 +613,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect preview file', async function () { it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
} }
await makeUploadRequest({ await makeUploadRequest({
@ -629,7 +629,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big preview file', async function () { it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams const fields = baseCorrectParams
const attaches = { const attaches = {
previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png')
} }
await makeUploadRequest({ await makeUploadRequest({

BIN
server/tests/fixtures/preview-big.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB