Merge pull request #1095 from edx/dhm/asset_bug

Fixed missing read (cut/paste f'up)
This commit is contained in:
Don Mitchell
2013-09-23 12:17:56 -07:00
2 changed files with 5 additions and 3 deletions

View File

@@ -907,7 +907,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
draft_store = modulestore('draft')
content_store = contentstore()
import_from_xml(module_store, 'common/test/data/', ['toy'])
import_from_xml(module_store, 'common/test/data/', ['toy'], static_content_store=content_store)
location = CourseDescriptor.id_to_location('edX/toy/2012_Fall')
# get a vertical (and components in it) to copy into an orphan sub dag
@@ -986,7 +986,9 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
delete_course(module_store, content_store, location, commit=True)
# reimport
import_from_xml(module_store, root_dir, ['test_export'], draft_store=draft_store)
import_from_xml(
module_store, root_dir, ['test_export'], draft_store=draft_store, static_content_store=content_store
)
items = module_store.get_items(Location(['i4x', 'edX', 'toy', 'vertical', None]))
self.assertGreater(len(items), 0)

View File

@@ -63,7 +63,7 @@ class MongoContentStore(ContentStore):
else:
with self.fs.get(content_id) as fp:
return StaticContent(
location, fp.displayname, fp.content_type, fp, last_modified_at=fp.uploadDate,
location, fp.displayname, fp.content_type, fp.read(), last_modified_at=fp.uploadDate,
thumbnail_location=getattr(fp, 'thumbnail_location', None),
import_path=getattr(fp, 'import_path', None),
length=fp.length, locked=getattr(fp, 'locked', False)