Commit 0967cb0d by Peter Fogg

Fix word cloud modules not exporting correctly.

parent 77a796e2
...@@ -855,6 +855,34 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): ...@@ -855,6 +855,34 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
shutil.rmtree(root_dir) 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): def test_course_handouts_rewrites(self):
module_store = modulestore('direct') module_store = modulestore('direct')
......
...@@ -9,6 +9,8 @@ If student have answered - words he entered and cloud. ...@@ -9,6 +9,8 @@ If student have answered - words he entered and cloud.
import json import json
import logging import logging
from lxml import etree
from pkg_resources import resource_string from pkg_resources import resource_string
from xmodule.raw_module import RawDescriptor from xmodule.raw_module import RawDescriptor
from xmodule.editing_module import MetadataOnlyEditingDescriptor from xmodule.editing_module import MetadataOnlyEditingDescriptor
...@@ -244,3 +246,9 @@ class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor, RawDes ...@@ -244,3 +246,9 @@ class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor, RawDes
"""Descriptor for WordCloud Xmodule.""" """Descriptor for WordCloud Xmodule."""
module_class = WordCloudModule module_class = WordCloudModule
template_dir_name = 'word_cloud' 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 />')
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