Ejemplo n.º 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()
Ejemplo n.º 2
0
 def create_enrollment(request):
     enrollment = Enrollment(state='registration')
     enrollment.save()
     request.session['enrollment'] = enrollment.pk
     return enrollment
Ejemplo n.º 3
0
 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