From f27ed07305994a9cd5e0c591de77e22fbf2ac547 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 15 Aug 2013 01:04:55 -0400 Subject: [PATCH] update tests to call definition_to_xml rather than export_to_xml, which presumes writing to a filesystem, plus it adds a url_name to the attribute set. Also, on __init__ reset the 'category' attribute, on some code paths this can get lost. Not sure why, but this gets all the tests to pass. --- common/lib/xmodule/xmodule/tests/test_video.py | 9 +++++---- common/lib/xmodule/xmodule/video_module.py | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/tests/test_video.py b/common/lib/xmodule/xmodule/tests/test_video.py index 4a13d565cc..ac1ab1d247 100644 --- a/common/lib/xmodule/xmodule/tests/test_video.py +++ b/common/lib/xmodule/xmodule/tests/test_video.py @@ -15,6 +15,7 @@ the course, section, subsection, unit, etc. import unittest from . import LogicTest +from lxml import etree from .import get_test_system from xmodule.modulestore import Location from xmodule.video_module import VideoDescriptor, _create_youtube_string @@ -344,7 +345,7 @@ class VideoExportTestCase(unittest.TestCase): desc.track = 'http://www.example.com/track' desc.html5_sources = ['http://www.example.com/source.mp4', 'http://www.example.com/source.ogg'] - xml = desc.export_to_xml(None) # We don't use the `resource_fs` parameter + xml = desc.definition_to_xml(None) # We don't use the `resource_fs` parameter expected = dedent('''\ ''') - self.assertEquals(expected, xml) + self.assertEquals(expected, etree.tostring(xml, pretty_print=True)) def test_export_to_xml_empty_parameters(self): """Test XML export with defaults.""" @@ -361,7 +362,7 @@ class VideoExportTestCase(unittest.TestCase): location = Location(["i4x", "edX", "video", "default", "SampleProblem1"]) desc = VideoDescriptor(module_system, {'location': location}) - xml = desc.export_to_xml(None) + xml = desc.definition_to_xml(None) expected = '