Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
883b6b8d
Commit
883b6b8d
authored
Aug 03, 2016
by
Seb
Browse files
New test for no ffmpeg
parent
f362463d
Changes
2
Hide whitespace changes
Inline
Side-by-side
setup.py
View file @
883b6b8d
...
...
@@ -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'
,
...
...
tests/test_admin_views.py
View file @
883b6b8d
...
...
@@ -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"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment