Beispiel #1
0
 def test_set_course_discussion_settings(self):
     set_course_discussion_settings(
         course_key=self.course.id,
         divided_discussions=['cohorted_topic'],
         division_scheme=CourseDiscussionSettings.ENROLLMENT_TRACK,
         always_divide_inline_discussions=True,
     )
     discussion_settings = get_course_discussion_settings(self.course.id)
     self.assertEqual(CourseDiscussionSettings.ENROLLMENT_TRACK, discussion_settings.division_scheme)
     self.assertEqual(['cohorted_topic'], discussion_settings.divided_discussions)
     self.assertTrue(discussion_settings.always_divide_inline_discussions)
Beispiel #2
0
    def test_invalid_data_types(self):
        exception_msg_template = "Incorrect field type for `{}`. Type must be `{}`"
        fields = [
            {'name': 'division_scheme', 'type': basestring},
            {'name': 'always_divide_inline_discussions', 'type': bool},
            {'name': 'divided_discussions', 'type': list}
        ]
        invalid_value = 3.14

        for field in fields:
            with self.assertRaises(ValueError) as value_error:
                set_course_discussion_settings(self.course.id, **{field['name']: invalid_value})

            self.assertEqual(
                text_type(value_error.exception),
                exception_msg_template.format(field['name'], field['type'].__name__)
            )