示例#1
0
    def setUp(self):
        super(EnrollmentModelTestCase, self).setUp()

        e = Enrollment()

        e.integration = Integration.objects.filter(
            name=BASE_TEST_INTEGRATION_NAME).first()

        e.policy = e.integration.policy
        e.username = BASE_TEST_USERNAME
        e.expires_at = timezone.now() + datetime.timedelta(minutes=10)

        e.save()
 def create(self, validated_data):
     enrollment = Enrollment()
     enrollment.course_id = self.initial_data.get('course_id')
     enrollment.student_id = self.initial_data.get('student_id')
     enrollment.save()
     return enrollment