From 3dbe4c189f714a9e4930ef975109ce12da3b89c1 Mon Sep 17 00:00:00 2001
From: Chris Dodge
Date: Wed, 31 Jul 2013 17:47:05 -0400
Subject: [PATCH] add unit tests around asserting that /static/ links are not
re-written on import
---
cms/djangoapps/contentstore/tests/test_contentstore.py | 10 ++++++++++
common/test/data/toy/course/2012_Fall.xml | 1 +
common/test/data/toy/html/toyhtml.html | 1 +
common/test/data/toy/html/toyhtml.xml | 1 +
4 files changed, 13 insertions(+)
create mode 100644 common/test/data/toy/html/toyhtml.html
create mode 100644 common/test/data/toy/html/toyhtml.xml
diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py
index 4c9fcf7f81..d01cd64a34 100644
--- a/cms/djangoapps/contentstore/tests/test_contentstore.py
+++ b/cms/djangoapps/contentstore/tests/test_contentstore.py
@@ -303,6 +303,16 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
num_drafts = self._get_draft_counts(course)
self.assertEqual(num_drafts, 1)
+ def test_no_static_link_rewrites_on_import(self):
+ module_store = modulestore('direct')
+ import_from_xml(module_store, 'common/test/data/', ['toy'])
+
+ handouts = module_store.get_item(Location(['i4x', 'edX', 'toy', 'course_info', 'handouts', None]))
+ self.assertIn('/static/', handouts.data)
+
+ handouts = module_store.get_item(Location(['i4x', 'edX', 'toy', 'html', 'toyhtml', None]))
+ self.assertIn('/static/', handouts.data)
+
def test_import_textbook_as_content_element(self):
module_store = modulestore('direct')
import_from_xml(module_store, 'common/test/data/', ['toy'])
diff --git a/common/test/data/toy/course/2012_Fall.xml b/common/test/data/toy/course/2012_Fall.xml
index 679f7bbfdb..2fd5401c24 100644
--- a/common/test/data/toy/course/2012_Fall.xml
+++ b/common/test/data/toy/course/2012_Fall.xml
@@ -4,6 +4,7 @@
+
diff --git a/common/test/data/toy/html/toyhtml.html b/common/test/data/toy/html/toyhtml.html
new file mode 100644
index 0000000000..85fa34d71d
--- /dev/null
+++ b/common/test/data/toy/html/toyhtml.html
@@ -0,0 +1 @@
+Sample
\ No newline at end of file
diff --git a/common/test/data/toy/html/toyhtml.xml b/common/test/data/toy/html/toyhtml.xml
new file mode 100644
index 0000000000..321253e441
--- /dev/null
+++ b/common/test/data/toy/html/toyhtml.xml
@@ -0,0 +1 @@
+