0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added test coverage for not supported media type

refs https://github.com/TryGhost/Toolbox/issues/95

- Only supported media types should be accepted by `/media/` enpoint
This commit is contained in:
Naz 2021-11-02 14:56:28 +04:00 committed by naz
parent d657432531
commit 7eb7e00634

View file

@ -67,4 +67,14 @@ describe('Media API', function () {
media.push(res.body.media[0].url.replace(config.get('url'), ''));
});
it('Rejects non-media file type', async function () {
const res = await request.post(localUtils.API.getApiQuery('media/upload'))
.set('Origin', config.get('url'))
.expect('Content-Type', /json/)
.attach('file', path.join(__dirname, '/../../utils/fixtures/images/favicon_16x_single.ico'))
.expect(415);
res.body.errors[0].message.should.match(/select a valid media file/gi);
});
});