Fix word cloud modules not exporting correctly.
This commit is contained in:
@@ -855,6 +855,34 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
|
||||
|
||||
shutil.rmtree(root_dir)
|
||||
|
||||
def test_export_course_with_metadata_only_word_cloud(self):
|
||||
"""
|
||||
Similar to `test_export_course_with_metadata_only_video`.
|
||||
"""
|
||||
module_store = modulestore('direct')
|
||||
draft_store = modulestore('draft')
|
||||
content_store = contentstore()
|
||||
|
||||
import_from_xml(module_store, 'common/test/data/', ['word_cloud'])
|
||||
location = CourseDescriptor.id_to_location('HarvardX/ER22x/2013_Spring')
|
||||
|
||||
verticals = module_store.get_items(['i4x', 'HarvardX', 'ER22x', 'vertical', None, None])
|
||||
|
||||
self.assertGreater(len(verticals), 0)
|
||||
|
||||
parent = verticals[0]
|
||||
|
||||
ItemFactory.create(parent_location=parent.location, category="word_cloud", display_name="untitled")
|
||||
|
||||
root_dir = path(mkdtemp_clean())
|
||||
|
||||
print 'Exporting to tempdir = {0}'.format(root_dir)
|
||||
|
||||
# export out to a tempdir
|
||||
export_to_xml(module_store, content_store, location, root_dir, 'test_export', draft_modulestore=draft_store)
|
||||
|
||||
shutil.rmtree(root_dir)
|
||||
|
||||
def test_course_handouts_rewrites(self):
|
||||
module_store = modulestore('direct')
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ If student have answered - words he entered and cloud.
|
||||
import json
|
||||
import logging
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from pkg_resources import resource_string
|
||||
from xmodule.raw_module import RawDescriptor
|
||||
from xmodule.editing_module import MetadataOnlyEditingDescriptor
|
||||
@@ -244,3 +246,9 @@ class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor, RawDes
|
||||
"""Descriptor for WordCloud Xmodule."""
|
||||
module_class = WordCloudModule
|
||||
template_dir_name = 'word_cloud'
|
||||
|
||||
def definition_to_xml(self, resource_fs):
|
||||
"""
|
||||
Since there's no real data, just return an empty XML tag.
|
||||
"""
|
||||
return etree.fromstring('<word_cloud />')
|
||||
|
||||
Reference in New Issue
Block a user