From 90a5703419b9322eb3d5c8130af6a655b938cb3e Mon Sep 17 00:00:00 2001 From: Victor Shnayder <victor@mitx.mit.edu> Date: Sat, 19 Jan 2013 14:18:06 -0500 Subject: [PATCH] Test for cohort config --- common/lib/xmodule/xmodule/tests/test_import.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/common/lib/xmodule/xmodule/tests/test_import.py b/common/lib/xmodule/xmodule/tests/test_import.py index 8fc8916..8a5eda3 100644 --- a/common/lib/xmodule/xmodule/tests/test_import.py +++ b/common/lib/xmodule/xmodule/tests/test_import.py @@ -353,3 +353,28 @@ class ImportTestCase(unittest.TestCase): <slider var="a" style="width:400px;float:left;"/>\ <plot style="margin-top:15px;margin-bottom:15px;"/>""".strip() self.assertEqual(gst_sample.definition['render'], render_string_from_sample_gst_xml) + + def test_cohort_config(self): + """ + Check that cohort config parsing works right. + """ + modulestore = XMLModuleStore(DATA_DIR, course_dirs=['toy']) + + toy_id = "edX/toy/2012_Fall" + + course = modulestore.get_course(toy_id) + + # No config -> False + self.assertFalse(course.is_cohorted) + + # empty config -> False + course.metadata['cohort-config'] = {} + self.assertFalse(course.is_cohorted) + + # false config -> False + course.metadata['cohort-config'] = {'cohorted': False} + self.assertFalse(course.is_cohorted) + + # and finally... + course.metadata['cohort-config'] = {'cohorted': True} + self.assertTrue(course.is_cohorted) -- libgit2 0.26.0