def test_fetch_course_content_milestones_null_keys(self): """ Unit Test: test_fetch_course_content_milestones_null_keys""" namespace = '{}.entrance_exams'.format( six.text_type(self.test_course_key)) milestone1 = api.add_milestone({ 'display_name': 'Test Milestone', 'name': 'test_milestone', 'namespace': namespace, 'description': 'Test Milestone Description', }) api.add_course_content_milestone(self.test_course_key, self.test_content_key, self.relationship_types['REQUIRES'], milestone1) milestones = data.fetch_milestones(milestone={'namespace': namespace}) self.assertEqual(len(milestones), 1) ccms = data.fetch_course_content_milestones( content_key=self.test_content_key, course_key=None, relationship=None) self.assertEqual(len(ccms), 1) ccms = data.fetch_course_content_milestones( content_key=None, course_key=self.test_course_key, relationship=None) self.assertEqual(len(ccms), 1)
def test_fetch_course_content_milestones_null_keys(self): """ Unit Test: test_fetch_course_content_milestones_null_keys""" namespace = '{}.entrance_exams'.format(unicode(self.test_course_key)) milestone1 = api.add_milestone({ 'display_name': 'Test Milestone', 'name': 'test_milestone', 'namespace': namespace, 'description': 'Test Milestone Description', }) api.add_course_content_milestone( self.test_course_key, self.test_content_key, self.relationship_types['REQUIRES'], milestone1 ) milestones = data.fetch_milestones(milestone={'namespace': namespace}) self.assertEqual(len(milestones), 1) ccms = data.fetch_course_content_milestones( content_key=self.test_content_key, course_key=None, relationship=None ) self.assertEqual(len(ccms), 1) ccms = data.fetch_course_content_milestones( content_key=None, course_key=self.test_course_key, relationship=None ) self.assertEqual(len(ccms), 1)
def test_fetch_milestones_invalid_milestone_namespace(self): """ Unit Test: test_fetch_milestones_invalid_milestone_namespace""" milestones = data.fetch_milestones( milestone={'namespace': "some.namespace"}) self.assertEqual(len(milestones), 0)
def test_fetch_courses_milestones_invalid_milestone(self): """ Unit Test: test_fetch_courses_milestones_invalid_milestone""" with self.assertRaises(exceptions.InvalidMilestoneException): data.fetch_milestones(milestone=None) with self.assertRaises(exceptions.InvalidMilestoneException): data.fetch_milestones(milestone={})
def test_fetch_milestones_invalid_milestone_namespace(self): """ Unit Test: test_fetch_milestones_invalid_milestone_namespace""" milestones = data.fetch_milestones(milestone={'namespace': "some.namespace"}) self.assertEqual(len(milestones), 0)