Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6b824897
Commit
6b824897
authored
Dec 16, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5685 from edx/uncomment-thumbnail-tests
Uncomment thumbnail tests
parents
cb1058ac
9440235a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
28 deletions
+30
-28
cms/djangoapps/contentstore/tests/test_contentstore.py
+30
-28
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
6b824897
...
...
@@ -13,6 +13,8 @@ from path import path
from
tempdir
import
mkdtemp_clean
from
textwrap
import
dedent
from
uuid
import
uuid4
from
functools
import
wraps
from
unittest
import
SkipTest
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
...
...
@@ -58,6 +60,26 @@ TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
def
requires_pillow_jpeg
(
func
):
"""
A decorator to indicate that the function requires JPEG support for Pillow,
otherwise it cannot be run
"""
@wraps
(
func
)
def
decorated_func
(
*
args
,
**
kwargs
):
"""
Execute the function if we have JPEG support in Pillow.
"""
try
:
from
PIL
import
Image
except
ImportError
:
raise
SkipTest
(
"Pillow is not installed (or not found)"
)
if
not
getattr
(
Image
.
core
,
"jpeg_decoder"
,
False
):
raise
SkipTest
(
"Pillow cannot open JPEG files"
)
return
func
(
*
args
,
**
kwargs
)
return
decorated_func
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
class
ContentStoreTestCase
(
CourseTestCase
):
"""
...
...
@@ -100,6 +122,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
effort
=
self
.
store
.
get_item
(
course_key
.
make_usage_key
(
'about'
,
'end_date'
))
self
.
assertEqual
(
effort
.
data
,
'TBD'
)
@requires_pillow_jpeg
def
test_asset_import
(
self
):
'''
This test validates that an image asset is imported and a thumbnail was generated for a .gif
...
...
@@ -117,37 +140,16 @@ class ImportRequiredTestCases(ContentStoreTestCase):
self
.
assertGreater
(
len
(
all_assets
),
0
)
# make sure we have some thumbnails in our contentstore
content_store
.
get_all_content_thumbnails_for_course
(
course
.
id
)
#
# cdodge: temporarily comment out assertion on thumbnails because many environments
# will not have the jpeg converter installed and this test will fail
#
#
# self.assertGreater(len(all_thumbnails), 0)
content
=
None
try
:
location
=
AssetLocation
.
from_deprecated_string
(
'/c4x/edX/toy/asset/sample_static.txt'
)
content
=
content_store
.
find
(
location
)
except
NotFoundError
:
pass
all_thumbnails
=
content_store
.
get_all_content_thumbnails_for_course
(
course
.
id
)
self
.
assertGreater
(
len
(
all_thumbnails
),
0
)
location
=
AssetLocation
.
from_deprecated_string
(
'/c4x/edX/toy/asset/just_a_test.jpg'
)
content
=
content_store
.
find
(
location
)
self
.
assertIsNotNone
(
content
)
#
# cdodge: temporarily comment out assertion on thumbnails because many environments
# will not have the jpeg converter installed and this test will fail
#
# self.assertIsNotNone(content.thumbnail_location)
#
# thumbnail = None
# try:
# thumbnail = content_store.find(content.thumbnail_location)
# except:
# pass
#
# self.assertIsNotNone(thumbnail)
self
.
assertIsNotNone
(
content
.
thumbnail_location
)
thumbnail
=
content_store
.
find
(
content
.
thumbnail_location
)
self
.
assertIsNotNone
(
thumbnail
)
def
test_course_info_updates_import_export
(
self
):
"""
...
...
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