Date: Tue, 15 Jan 2013 17:54:10 -0500
Subject: [PATCH] disable export of testcenter_exam from course module (and add
test).
---
.../lib/xmodule/xmodule/tests/test_export.py | 4 ++
common/lib/xmodule/xmodule/xml_module.py | 10 ++++-
.../data/test_exam_registration/README.md | 2 +
.../data/test_exam_registration/course.xml | 1 +
.../course/2012_Fall.xml | 15 +++++++
.../test_exam_registration/html/toylab.html | 3 ++
.../test_exam_registration/html/toylab.xml | 1 +
.../policies/2012_Fall.json | 42 +++++++++++++++++++
.../roots/2012_Fall.xml | 1 +
lms/envs/common.py | 1 +
10 files changed, 78 insertions(+), 2 deletions(-)
create mode 100644 common/test/data/test_exam_registration/README.md
create mode 120000 common/test/data/test_exam_registration/course.xml
create mode 100644 common/test/data/test_exam_registration/course/2012_Fall.xml
create mode 100644 common/test/data/test_exam_registration/html/toylab.html
create mode 100644 common/test/data/test_exam_registration/html/toylab.xml
create mode 100644 common/test/data/test_exam_registration/policies/2012_Fall.json
create mode 100644 common/test/data/test_exam_registration/roots/2012_Fall.xml
diff --git a/common/lib/xmodule/xmodule/tests/test_export.py b/common/lib/xmodule/xmodule/tests/test_export.py
index 7605155a6c..f92d58db03 100644
--- a/common/lib/xmodule/xmodule/tests/test_export.py
+++ b/common/lib/xmodule/xmodule/tests/test_export.py
@@ -124,3 +124,7 @@ class RoundTripTestCase(unittest.TestCase):
def test_graphicslidertool_roundtrip(self):
#Test graphicslidertool xmodule to see if it exports correctly
self.check_export_roundtrip(DATA_DIR,"graphic_slider_tool")
+
+ def test_exam_registration_roundtrip(self):
+ # Test exam_registration xmodule to see if it exports correctly
+ self.check_export_roundtrip(DATA_DIR,"test_exam_registration")
diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py
index bb5b44c67f..9ad36f633d 100644
--- a/common/lib/xmodule/xmodule/xml_module.py
+++ b/common/lib/xmodule/xmodule/xml_module.py
@@ -94,12 +94,18 @@ class XmlDescriptor(XModuleDescriptor):
'start', 'due', 'graded', 'display_name', 'url_name', 'hide_from_toc',
'ispublic', # if True, then course is listed for all users; see
'xqa_key', # for xqaa server access
+ # information about testcenter exams is a dict (of dicts), not a string,
+ # so it cannot be easily exportable as a course element's attribute.
+ 'testcenter_info',
# VS[compat] Remove once unused.
'name', 'slug')
metadata_to_strip = ('data_dir',
- # VS[compat] -- remove the below attrs once everything is in the CMS
- 'course', 'org', 'url_name', 'filename')
+ # information about testcenter exams is a dict (of dicts), not a string,
+ # so it cannot be easily exportable as a course element's attribute.
+ 'testcenter_info',
+ # VS[compat] -- remove the below attrs once everything is in the CMS
+ 'course', 'org', 'url_name', 'filename')
# A dictionary mapping xml attribute names AttrMaps that describe how
# to import and export them
diff --git a/common/test/data/test_exam_registration/README.md b/common/test/data/test_exam_registration/README.md
new file mode 100644
index 0000000000..5097fe8798
--- /dev/null
+++ b/common/test/data/test_exam_registration/README.md
@@ -0,0 +1,2 @@
+Simple course with test center exam information included in policy.json.
+
diff --git a/common/test/data/test_exam_registration/course.xml b/common/test/data/test_exam_registration/course.xml
new file mode 120000
index 0000000000..49041310f6
--- /dev/null
+++ b/common/test/data/test_exam_registration/course.xml
@@ -0,0 +1 @@
+roots/2012_Fall.xml
\ No newline at end of file
diff --git a/common/test/data/test_exam_registration/course/2012_Fall.xml b/common/test/data/test_exam_registration/course/2012_Fall.xml
new file mode 100644
index 0000000000..77eca9f46c
--- /dev/null
+++ b/common/test/data/test_exam_registration/course/2012_Fall.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+ Welcome
+
+
+
+
diff --git a/common/test/data/test_exam_registration/html/toylab.html b/common/test/data/test_exam_registration/html/toylab.html
new file mode 100644
index 0000000000..81df84bd63
--- /dev/null
+++ b/common/test/data/test_exam_registration/html/toylab.html
@@ -0,0 +1,3 @@
+Lab 2A: Superposition Experiment
+
+Isn't the toy course great?
diff --git a/common/test/data/test_exam_registration/html/toylab.xml b/common/test/data/test_exam_registration/html/toylab.xml
new file mode 100644
index 0000000000..ab78aeb494
--- /dev/null
+++ b/common/test/data/test_exam_registration/html/toylab.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/common/test/data/test_exam_registration/policies/2012_Fall.json b/common/test/data/test_exam_registration/policies/2012_Fall.json
new file mode 100644
index 0000000000..49af7d1527
--- /dev/null
+++ b/common/test/data/test_exam_registration/policies/2012_Fall.json
@@ -0,0 +1,42 @@
+{
+ "course/2012_Fall": {
+ "graceperiod": "2 days 5 hours 59 minutes 59 seconds",
+ "start": "2011-07-17T12:00",
+ "display_name": "Toy Course",
+ "testcenter_info": {
+ "Midterm_Exam": {
+ "Exam_Series_Code": "Midterm_Exam",
+ "First_Eligible_Appointment_Date": "2012-11-09T00:00",
+ "Last_Eligible_Appointment_Date": "2012-11-09T23:59"
+ },
+ "Final_Exam": {
+ "Exam_Series_Code": "mit6002xfall12a",
+ "Exam_Display_Name": "Final Exam",
+ "First_Eligible_Appointment_Date": "2013-01-25T00:00",
+ "Last_Eligible_Appointment_Date": "2013-01-25T23:59",
+ "Registration_Start_Date": "2013-01-01T00:00",
+ "Registration_End_Date": "2013-01-21T23:59"
+ }
+ }
+ },
+ "chapter/Overview": {
+ "display_name": "Overview"
+ },
+ "chapter/Ch2": {
+ "display_name": "Chapter 2",
+ "start": "2015-07-17T12:00"
+ },
+ "videosequence/Toy_Videos": {
+ "display_name": "Toy Videos",
+ "format": "Lecture Sequence"
+ },
+ "html/toylab": {
+ "display_name": "Toy lab"
+ },
+ "video/Video_Resources": {
+ "display_name": "Video Resources"
+ },
+ "video/Welcome": {
+ "display_name": "Welcome"
+ }
+}
diff --git a/common/test/data/test_exam_registration/roots/2012_Fall.xml b/common/test/data/test_exam_registration/roots/2012_Fall.xml
new file mode 100644
index 0000000000..30dd5e0180
--- /dev/null
+++ b/common/test/data/test_exam_registration/roots/2012_Fall.xml
@@ -0,0 +1 @@
+