From 2769e297ca6703f761f9b57792585eb1fc5aac49 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Aug 2018 11:45:24 +0200 Subject: Fix caption upload on Mac OS --- server/tests/api/check-params/video-captions.ts | 26 +++++++++++++++++++++++++ server/tests/api/videos/video-captions.ts | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index a3d7ac35d..8d46971a1 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts @@ -15,6 +15,7 @@ import { userLogin } from '../../utils' import { join } from 'path' +import { createVideoCaption } from '../../utils/videos/video-captions' describe('Test video captions API validator', function () { const path = '/api/v1/videos/' @@ -143,6 +144,31 @@ describe('Test video captions API validator', function () { }) }) + // We don't check the extension yet + // it('Should fail with an invalid captionfile extension and octet-stream mime type', async function () { + // await createVideoCaption({ + // url: server.url, + // accessToken: server.accessToken, + // language: 'zh', + // videoId: videoUUID, + // fixture: 'subtitle-bad.txt', + // mimeType: 'application/octet-stream', + // statusCodeExpected: 400 + // }) + // }) + + it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () { + await createVideoCaption({ + url: server.url, + accessToken: server.accessToken, + language: 'zh', + videoId: videoUUID, + fixture: 'subtitle-good.srt', + mimeType: 'application/octet-stream' + }) + }) + + // We don't check the file validity yet // it('Should fail with an invalid captionfile srt', async function () { // const attaches = { // 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-bad.srt') diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index eb73c5baf..ba9ebbdd6 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts @@ -56,7 +56,8 @@ describe('Test video captions', function () { accessToken: servers[0].accessToken, language: 'zh', videoId: videoUUID, - fixture: 'subtitle-good2.vtt' + fixture: 'subtitle-good2.vtt', + mimeType: 'application/octet-stream' }) await waitJobs(servers) -- cgit v1.2.3