Cleaner tests
This commit is contained in:
@@ -133,7 +133,7 @@ class SequenceDescriptor(SequenceFields, MakoModuleDescriptor, XmlDescriptor):
|
||||
except Exception as e:
|
||||
log.exception("Unable to load child when parsing Sequence. Continuing...")
|
||||
if system.error_tracker is not None:
|
||||
system.error_tracker("ERROR: " + str(e))
|
||||
system.error_tracker("ERROR: " + unicode(e))
|
||||
continue
|
||||
return {}, children
|
||||
|
||||
|
||||
@@ -380,32 +380,22 @@ class ImportTestCase(BaseCourseTestCase):
|
||||
courses = modulestore.get_courses()
|
||||
self.assertEquals(len(courses), 1)
|
||||
course = courses[0]
|
||||
course_id = course.id
|
||||
|
||||
print("course errors:")
|
||||
|
||||
# Expect to find an error/exception about characters in "®esources"
|
||||
found = False
|
||||
expect = "Invalid characters in '®esources'"
|
||||
for (msg, err) in modulestore.get_item_errors(course.location):
|
||||
msg_u = msg.encode("utf-8")
|
||||
err_u = err.encode("utf-8")
|
||||
print(msg_u)
|
||||
print(err_u)
|
||||
if max(msg_u.find(expect), err_u.find(expect)) >= 1:
|
||||
found = True
|
||||
errors = [(msg.encode("utf-8"), err.encode("utf-8"))
|
||||
for msg, err in
|
||||
modulestore.get_item_errors(course.location)]
|
||||
|
||||
self.assertTrue(found)
|
||||
self.assertTrue(any(expect in msg or expect in err
|
||||
for msg, err in errors))
|
||||
chapters = course.get_children()
|
||||
self.assertEquals(len(chapters), 5)
|
||||
self.assertEqual(len(chapters), 3)
|
||||
|
||||
ch2 = chapters[1]
|
||||
self.assertEquals(ch2.url_name, "secret:magic")
|
||||
ch3 = chapters[2]
|
||||
|
||||
print("Ch2 location: ", ch2.location)
|
||||
|
||||
also_ch2 = modulestore.get_instance(course_id, ch2.location)
|
||||
self.assertEquals(ch2, also_ch2)
|
||||
|
||||
def test_url_name_mangling(self):
|
||||
"""
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<sequential>
|
||||
<html> <a href="/static/handouts/sample_handout.txt"> handouts</a> </html>
|
||||
</sequential>
|
||||
@@ -1,7 +0,0 @@
|
||||
<sequential>
|
||||
<poll_question name="T1_changemind_poll_foo" display_name="Change your answer" reset="false">
|
||||
<p>Have you changed your mind?</p>
|
||||
<answer id="yes">Yes</answer>
|
||||
<answer id="no">No</answer>
|
||||
</poll_question>
|
||||
</sequential>
|
||||
@@ -1,3 +0,0 @@
|
||||
<chapter>
|
||||
<video url_name="toyvideo" youtube_id_1_0="OEoXaMPEzfMA" display_name="toyvideo"/>
|
||||
</chapter>
|
||||
8
common/test/data/test_unicode/chapter/simple_html.xml
Normal file
8
common/test/data/test_unicode/chapter/simple_html.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<chapter display_name="åñ html ƒile">
|
||||
<sequential display_name="åñ html ƒile">
|
||||
<html display_name="åñ html ƒile">
|
||||
<p> This is upside down text:</p>
|
||||
<p>˙ʇxəʇ uʍop əpısdn sı sıɥʇ</p>
|
||||
</html>
|
||||
</sequential>
|
||||
</chapter>
|
||||
@@ -1,20 +1,8 @@
|
||||
<course>
|
||||
<textbook title="Textbook" book_url="https://s3.amazonaws.com/edx-textbooks/guttag_computation_v3/"/>
|
||||
<chapter display_name="Overview">
|
||||
<videosequence url_name="Toy_Videos">
|
||||
<html url_name="secret:toylab"/>
|
||||
<html url_name="toyjumpto"/>
|
||||
<html url_name="toyhtml"/>
|
||||
<html url_name="nonportable"/>
|
||||
<html url_name="nonportable_link"/>
|
||||
<video url_name="Video_Resources" youtube_id_1_0="1bK-WdDi6Qw" display_name="Video Resources"/>
|
||||
</videosequence>
|
||||
<video url_name="Welcome" youtube_id_1_0="p2Q6BrNhdh8" display_name="Welcome"/>
|
||||
<video url_name="video_123456789012" youtube_id_1_0="p2Q6BrNhdh8" display_name='Test Video'/>
|
||||
<video url_name="video_4f66f493ac8f" youtube_id_1_0="p2Q6BrNhdh8"/>
|
||||
</chapter>
|
||||
<chapter url_name="secret:magic"/>
|
||||
<chapter url_name="poll_test"/>
|
||||
<chapter url_name="sîmple_√ideo"/>
|
||||
<chapter url_name="simple_html"/>
|
||||
<chapter url_name="vertical_container"/>
|
||||
<chapter url_name="handout_container"/>
|
||||
</course>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<a href='/static/handouts/sample_handout.txt'>Sample</a>
|
||||
@@ -2,13 +2,13 @@
|
||||
"course/2012_Fall": {
|
||||
"graceperiod": "2 days 5 hours 59 minutes 59 seconds",
|
||||
"start": "2015-07-17T12:00",
|
||||
"display_name": "Toy Course",
|
||||
"display_name": "Üñîçø∂e †es† Course",
|
||||
"graded": "true",
|
||||
"tabs": [
|
||||
{"type": "courseware"},
|
||||
{"type": "course_info", "name": "Course Info"},
|
||||
{"type": "static_tab", "url_slug": "syllabus", "name": "ßyllabus"},
|
||||
{"type": "static_tab", "url_slug": "resources", "name": "Resources"},
|
||||
{"type": "static_tab", "url_slug": "resources", "name": "®esources"},
|
||||
{"type": "discussion", "name": "∂iscussion"},
|
||||
{"type": "wiki", "name": "∑iki"},
|
||||
{"type": "progress", "name": "πrogress"}
|
||||
@@ -17,16 +17,6 @@
|
||||
"chapter/Overview": {
|
||||
"display_name": "O√erview"
|
||||
},
|
||||
"videosequence/Toy_Videos": {
|
||||
"display_name": "†oy Videos",
|
||||
"format": "Lecture Sequence"
|
||||
},
|
||||
"html/secret:toylab": {
|
||||
"display_name": "Toy lab"
|
||||
},
|
||||
"video/Video_Resources": {
|
||||
"display_name": "Video Resources"
|
||||
},
|
||||
"video/Welcome": {
|
||||
"display_name": "Welcome"
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<p>this ƒîlë should be in the contentstore</p>
|
||||
@@ -1 +0,0 @@
|
||||
<h1>This is a syllabus</h1>
|
||||
@@ -1 +0,0 @@
|
||||
<video display_name="default" youtube_id_0_75="JMD_ifUUfsU" youtube_id_1_0="OEoXaMPEzfM" youtube_id_1_25="AKqURZnYqpk" youtube_id_1_5="DYpADpL7jAY" name="sample_video"/>
|
||||
Reference in New Issue
Block a user