Commit 3e62c5e2 by Julian Arni

Cleaner tests

parent 9d3395ea
......@@ -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
self.assertTrue(found)
chapters = course.get_children()
self.assertEquals(len(chapters), 5)
errors = [(msg.encode("utf-8"), err.encode("utf-8"))
for msg, err in
modulestore.get_item_errors(course.location)]
ch2 = chapters[1]
self.assertEquals(ch2.url_name, "secret:magic")
self.assertTrue(any(expect in msg or expect in err
for msg, err in errors))
chapters = course.get_children()
self.assertEqual(len(chapters), 3)
print("Ch2 location: ", ch2.location)
ch3 = chapters[2]
also_ch2 = modulestore.get_instance(course_id, ch2.location)
self.assertEquals(ch2, also_ch2)
def test_url_name_mangling(self):
"""
......
<sequential>
<html> <a href="/static/handouts/sample_handout.txt"> handouts</a> </html>
</sequential>
\ No newline at end of file
<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>
\ No newline at end of file
<chapter>
<video url_name="toyvideo" youtube_id_1_0="OEoXaMPEzfMA" display_name="toyvideo"/>
</chapter>
<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>
<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>
<a href='/static/handouts/sample_handout.txt'>Sample</a>
\ No newline at end of file
......@@ -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"
}
......
<p>this ƒîlë should be in the contentstore</p>
++ /dev/null
<p>this ƒîlë should be in the contentstore</p>
<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"/>
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