예제 #1
0
    def test_get_course_enrollment(self, course_modes, enrollment_mode):
        self._create_course_modes(course_modes)

        # Try to get an enrollment before it exists.
        result = data.get_course_enrollment(self.user.username,
                                            six.text_type(self.course.id))
        assert result is None

        # Create the original enrollment.
        enrollment = data.create_course_enrollment(
            self.user.username, six.text_type(self.course.id), enrollment_mode,
            True)
        # Get the enrollment and compare it to the original.
        result = data.get_course_enrollment(self.user.username,
                                            six.text_type(self.course.id))
        assert self.user.username == result['user']
        assert enrollment == result
예제 #2
0
    def test_get_course_enrollment(self, course_modes, enrollment_mode):
        self._create_course_modes(course_modes)

        # Try to get an enrollment before it exists.
        result = data.get_course_enrollment(self.user.username, six.text_type(self.course.id))
        self.assertIsNone(result)

        # Create the original enrollment.
        enrollment = data.create_course_enrollment(
            self.user.username,
            six.text_type(self.course.id),
            enrollment_mode,
            True
        )
        # Get the enrollment and compare it to the original.
        result = data.get_course_enrollment(self.user.username, six.text_type(self.course.id))
        self.assertEqual(self.user.username, result['user'])
        self.assertEqual(enrollment, result)