Commit 883b6b8d authored by Seb's avatar Seb
Browse files

New test for no ffmpeg

parent f362463d
......@@ -20,6 +20,7 @@ setup(
install_requires=[
'wagtail>=1.4',
'django-enumchoicefield==0.6.0',
'mock==2.0.0'
],
zip_safe=False,
license='BSD License',
......
......@@ -8,6 +8,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.template.defaultfilters import filesizeformat
from django.test import TestCase, override_settings
from mock import patch
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Collection, GroupCollectionPermission
......@@ -105,6 +106,28 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
root_collection = Collection.get_first_root_node()
self.assertEqual(video.collection, root_collection)
@patch('wagtailvideos.utils.ffmpeg_installed')
def test_add_no_ffmpeg(self, mock_ffmpeg):
mock_ffmpeg.return_value = False
video_file = create_test_video_file()
title = 'no_ffmpeg'
response = self.post({
'title': title,
'file': SimpleUploadedFile('small.mp4', video_file.read(), "video/mp4"),
})
# Should redirect back to index
self.assertRedirects(response, reverse('wagtailvideos:index'))
# Check video exists but has no thumb or duration
videos = Video.objects.filter(title=title)
self.assertEqual(videos.count(), 1)
video = videos.first()
self.assertFalse(video.thumbnail)
self.assertFalse(video.duration)
def test_add_no_file_selected(self):
response = self.post({
'title': "nothing here",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment