Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
 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)
Beispiel #4
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={})
Beispiel #5
0
 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)
Beispiel #6
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={})