Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
 def test_fetch_course_content_milestones_invalid_milestone_relationship_type(self):
     """ Unit Test: test_fetch_course_content_milestones_invalid_milestone_relationship_type"""
     milestone1 = api.add_milestone({
         'display_name': 'Test Milestone',
         'name': 'test_milestone',
         'namespace': unicode(self.test_course_key),
         'description': 'Test Milestone Description',
     })
     api.add_course_content_milestone(
         self.test_course_key,
         self.test_content_key,
         self.relationship_types['REQUIRES'],
         milestone1
     )
     milestone2 = api.add_milestone({
         'display_name': 'Test Milestone 2',
         'name': 'test_milestone2',
         'namespace': unicode(self.test_course_key),
         'description': 'Test Milestone Description 2',
     })
     api.add_course_content_milestone(
         self.test_course_key,
         self.test_content_key,
         self.relationship_types['FULFILLS'],
         milestone2
     )
     with self.assertRaises(exceptions.InvalidMilestoneRelationshipTypeException):
         data.fetch_course_content_milestones(
             self.test_course_key,
             self.test_content_key,
             'invalid_relationshipppp'
         )
Ejemplo n.º 4
0
 def test_fetch_course_content_milestones_invalid_milestone_relationship_type(
         self):
     """ Unit Test: test_fetch_course_content_milestones_invalid_milestone_relationship_type"""
     milestone1 = api.add_milestone({
         'display_name':
         'Test Milestone',
         'name':
         'test_milestone',
         'namespace':
         six.text_type(self.test_course_key),
         'description':
         'Test Milestone Description',
     })
     api.add_course_content_milestone(self.test_course_key,
                                      self.test_content_key,
                                      self.relationship_types['REQUIRES'],
                                      milestone1)
     milestone2 = api.add_milestone({
         'display_name':
         'Test Milestone 2',
         'name':
         'test_milestone2',
         'namespace':
         six.text_type(self.test_course_key),
         'description':
         'Test Milestone Description 2',
     })
     api.add_course_content_milestone(self.test_course_key,
                                      self.test_content_key,
                                      self.relationship_types['FULFILLS'],
                                      milestone2)
     with self.assertRaises(
             exceptions.InvalidMilestoneRelationshipTypeException):
         data.fetch_course_content_milestones(self.test_course_key,
                                              self.test_content_key,
                                              'invalid_relationshipppp')