Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix tests

Chocobozzze9cb361cf51d
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index c06eb6fb06..0b4b412731 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -274,8 +274,6 @@ const CONSTRAINTS_FIELDS = {
DURATION: { min: 0 }, // Number
TAGS: { min: 0, max: 5 }, // Number of total tags
TAG: { min: 2, max: 30 }, // Length
- THUMBNAIL: { min: 2, max: 30 },
- THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes
VIEWS: { min: 0 },
LIKES: { min: 0 },
DISLIKES: { min: 0 },
@@ -750,6 +748,7 @@ if (isTestInstance() === true) {
ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
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.removeOldJobs = 10000
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index a5493572ba..c171b1f811 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -180,7 +180,7 @@ describe('Test video lives API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
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 })
@@ -189,7 +189,7 @@ describe('Test video lives API validator', function () {
it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams
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 })
@@ -198,7 +198,7 @@ describe('Test video lives API validator', function () {
it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams
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 })
@@ -207,7 +207,7 @@ describe('Test video lives API validator', function () {
it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams
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 })
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 49ff96117a..6de6b40c80 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -201,7 +201,7 @@ describe('Test video imports API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
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 })
@@ -210,7 +210,7 @@ describe('Test video imports API validator', function () {
it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams
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 })
@@ -219,7 +219,7 @@ describe('Test video imports API validator', function () {
it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams
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 })
@@ -228,7 +228,7 @@ describe('Test video imports API validator', function () {
it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams
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 })
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 418af05d17..bbea88354c 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -251,7 +251,14 @@ describe('Test video playlists API validator', 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 updateVideoPlaylist(getUpdate(params, playlistUUID))
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 5faba82c44..188d1835c1 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -373,7 +373,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
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')
}
@@ -383,7 +383,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams
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')
}
@@ -393,7 +393,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams
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')
}
@@ -403,7 +403,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams
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')
}
@@ -581,7 +581,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
- thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
}
await makeUploadRequest({
@@ -597,7 +597,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big thumbnail file', async function () {
const fields = baseCorrectParams
const attaches = {
- thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png')
}
await makeUploadRequest({
@@ -613,7 +613,7 @@ describe('Test videos API validator', function () {
it('Should fail with an incorrect preview file', async function () {
const fields = baseCorrectParams
const attaches = {
- previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
}
await makeUploadRequest({
@@ -629,7 +629,7 @@ describe('Test videos API validator', function () {
it('Should fail with a big preview file', async function () {
const fields = baseCorrectParams
const attaches = {
- previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png')
}
await makeUploadRequest({
diff --git a/server/tests/fixtures/preview-big.png b/server/tests/fixtures/preview-big.png
new file mode 100644
index 0000000000..612e297f10
Binary files /dev/null and b/server/tests/fixtures/preview-big.png differ