示例#1
0
    def test_add_or_update_enrollment_attr(self, course_modes,
                                           enrollment_mode):
        # Create the course modes (if any) required for this test case
        self._create_course_modes(course_modes)
        data.create_course_enrollment(self.user.username,
                                      six.text_type(self.course.id),
                                      enrollment_mode, True)
        enrollment_attributes = [{
            "namespace": "credit",
            "name": "provider_id",
            "value": "hogwarts",
        }]

        data.add_or_update_enrollment_attr(self.user.username,
                                           six.text_type(self.course.id),
                                           enrollment_attributes)
        enrollment_attr = data.get_enrollment_attributes(
            self.user.username, six.text_type(self.course.id))
        assert enrollment_attr[0] == enrollment_attributes[0]

        enrollment_attributes = [{
            "namespace": "credit",
            "name": "provider_id",
            "value": "ASU",
        }]

        data.add_or_update_enrollment_attr(self.user.username,
                                           six.text_type(self.course.id),
                                           enrollment_attributes)
        enrollment_attr = data.get_enrollment_attributes(
            self.user.username, six.text_type(self.course.id))
        assert enrollment_attr[0] == enrollment_attributes[0]
示例#2
0
    def test_add_or_update_enrollment_attr(self, course_modes, enrollment_mode):
        # Create the course modes (if any) required for this test case
        self._create_course_modes(course_modes)
        data.create_course_enrollment(self.user.username, six.text_type(self.course.id), enrollment_mode, True)
        enrollment_attributes = [
            {
                "namespace": "credit",
                "name": "provider_id",
                "value": "hogwarts",
            }
        ]

        data.add_or_update_enrollment_attr(self.user.username, six.text_type(self.course.id), enrollment_attributes)
        enrollment_attr = data.get_enrollment_attributes(self.user.username, six.text_type(self.course.id))
        self.assertEqual(enrollment_attr[0], enrollment_attributes[0])

        enrollment_attributes = [
            {
                "namespace": "credit",
                "name": "provider_id",
                "value": "ASU",
            }
        ]

        data.add_or_update_enrollment_attr(self.user.username, six.text_type(self.course.id), enrollment_attributes)
        enrollment_attr = data.get_enrollment_attributes(self.user.username, six.text_type(self.course.id))
        self.assertEqual(enrollment_attr[0], enrollment_attributes[0])