コード例 #1
0
    def _create_user_data(self,
                          user_enroll_mode,
                          has_passed,
                          whitelisted,
                          is_embargoed,
                          verification_status,
                          certificate_status,
                          certificate_mode):
        """
        Create user data to be used during grade report generation.
        """

        user = self.create_student('u1', mode=user_enroll_mode)

        if has_passed:
            self.submit_student_answer('u1', 'test_problem', ['choice_1'])

        CertificateWhitelistFactory.create(user=user, course_id=self.course.id, whitelist=whitelisted)

        self.user_is_embargoed(user, is_embargoed)

        if user_enroll_mode in CourseMode.VERIFIED_MODES:
            SoftwareSecurePhotoVerificationFactory.create(user=user, status=verification_status)

        GeneratedCertificateFactory.create(
            user=user,
            course_id=self.course.id,
            status=certificate_status,
            mode=certificate_mode
        )

        return user
コード例 #2
0
    def setup_course_and_user(
            self,
            days_till_start=1,
            days_till_end=14,
            days_till_upgrade_deadline=4,
            enrollment_mode=CourseMode.VERIFIED,
            days_till_verification_deadline=14,
            verification_status=None,
    ):
        """Set up the course and user for this test."""
        now = datetime.now(pytz.UTC)
        self.course = CourseFactory.create(  # pylint: disable=attribute-defined-outside-init
            start=now + timedelta(days=days_till_start),
            end=now + timedelta(days=days_till_end),
        )
        self.user = UserFactory.create()  # pylint: disable=attribute-defined-outside-init

        if enrollment_mode is not None and days_till_upgrade_deadline is not None:
            CourseModeFactory.create(
                course_id=self.course.id,
                mode_slug=enrollment_mode,
                expiration_datetime=now + timedelta(days=days_till_upgrade_deadline)
            )
            CourseEnrollmentFactory.create(course_id=self.course.id, user=self.user, mode=enrollment_mode)
        else:
            CourseEnrollmentFactory.create(course_id=self.course.id, user=self.user)

        if days_till_verification_deadline is not None:
            VerificationDeadline.objects.create(
                course_key=self.course.id,
                deadline=now + timedelta(days=days_till_verification_deadline)
            )

        if verification_status is not None:
            SoftwareSecurePhotoVerificationFactory.create(user=self.user, status=verification_status)
コード例 #3
0
 def setUp(self):
     super(XQueueCertInterfaceAddCertificateTest, self).setUp()
     self.user = UserFactory.create()
     self.course = CourseFactory.create()
     self.enrollment = CourseEnrollmentFactory(
         user=self.user,
         course_id=self.course.id,
         is_active=True,
         mode="honor",
     )
     self.xqueue = XQueueCertInterface()
     self.user_2 = UserFactory.create()
     SoftwareSecurePhotoVerificationFactory.create(user=self.user_2, status='approved')
コード例 #4
0
 def setUp(self):
     super(XQueueCertInterfaceAddCertificateTest, self).setUp()
     self.user = UserFactory.create()
     self.course = CourseFactory.create()
     self.enrollment = CourseEnrollmentFactory(
         user=self.user,
         course_id=self.course.id,
         is_active=True,
         mode="honor",
     )
     self.xqueue = XQueueCertInterface()
     self.user_2 = UserFactory.create()
     SoftwareSecurePhotoVerificationFactory.create(user=self.user_2,
                                                   status='approved')
コード例 #5
0
    def setup_course_and_user(
        self,
        days_till_start=1,
        days_till_end=14,
        days_till_upgrade_deadline=4,
        enrollment_mode=CourseMode.VERIFIED,
        days_till_verification_deadline=14,
        verification_status=None,
    ):
        """Set up the course and user for this test."""
        now = datetime.now(pytz.UTC)
        self.course = CourseFactory.create(  # pylint: disable=attribute-defined-outside-init
            start=now + timedelta(days=days_till_start))
        self.user = UserFactory.create()  # pylint: disable=attribute-defined-outside-init

        if days_till_end is not None:
            self.course.end = now + timedelta(days=days_till_end)
        else:
            self.course.end = None

        if enrollment_mode is not None and days_till_upgrade_deadline is not None:
            CourseModeFactory.create(
                course_id=self.course.id,
                mode_slug=enrollment_mode,
                expiration_datetime=now +
                timedelta(days=days_till_upgrade_deadline))
            CourseEnrollmentFactory.create(course_id=self.course.id,
                                           user=self.user,
                                           mode=enrollment_mode)
        else:
            CourseEnrollmentFactory.create(course_id=self.course.id,
                                           user=self.user)

        if days_till_verification_deadline is not None:
            VerificationDeadline.objects.create(
                course_key=self.course.id,
                deadline=now + timedelta(days=days_till_verification_deadline))

        if verification_status is not None:
            SoftwareSecurePhotoVerificationFactory.create(
                user=self.user, status=verification_status)