Пример #1
0
    def create_audited_passed_enrolled_again_failed(self):
        """Make course passed and user retaking/auditing the course again"""
        self.make_fa_program_enrollment(FinancialAidStatus.AUTO_APPROVED)
        course = Course.objects.get(title='Digital Learning 200')
        CourseCertificateSignatoriesFactory.create(course=course)

        course_run = CourseRunFactory(course=course, edx_course_key='course-passed')
        set_course_run_past(course_run)
        call_command(
            "alter_data", 'set_to_passed', '--username', 'staff',
            '--course-run-key', course_run.edx_course_key, '--grade', '80', '--audit'
        )
        final_grade = FinalGrade.objects.filter(
            course_run__course__title='Digital Learning 200', user=self.user
        ).first()
        CourseRunGradingStatus.objects.create(course_run=final_grade.course_run, status='complete')

        course_run = CourseRunFactory(course=course, edx_course_key='course-failed')
        set_course_run_past(course_run)
        call_command(
            "alter_data", 'set_to_failed', '--username', 'staff',
            '--course-run-key', course_run.edx_course_key, '--grade', '10', '--audit'
        )

        course_run = CourseRunFactory(course=course, edx_course_key='course-offered')
        set_course_run_future(course_run)
        call_command(
            'alter_data', 'set_to_offered', '--username', 'staff',
            '--course-run-key', course_run.edx_course_key,
        )
Пример #2
0
    def create_passed_and_offered_course_run(self, grades_frozen, with_certificate):
        """Make passed and currently offered course run, and see the View Certificate and Re-Enroll"""
        self.make_fa_program_enrollment(FinancialAidStatus.AUTO_APPROVED)
        call_command(
            "alter_data", 'set_to_passed', '--username', 'staff',
            '--course-title', 'Digital Learning 200', '--grade', '89',
        )
        course = Course.objects.get(title='Digital Learning 200')
        # create another currently offered run
        CourseRunFactory.create(course=course)

        if grades_frozen:
            final_grade = FinalGrade.objects.filter(user=self.user, course_run__course=course, passed=True).first()
            CourseRunGradingStatus.objects.create(course_run=final_grade.course_run, status='complete')
            if with_certificate:
                MicromastersCourseCertificate.objects.create(user=self.user, course=course)
                CourseCertificateSignatoriesFactory.create(course=course)
Пример #3
0
    def create_passed_enrolled_again(self):
        """Make course passed and user retaking/auditing the course again"""
        self.make_fa_program_enrollment(FinancialAidStatus.AUTO_APPROVED)
        course = Course.objects.get(title='Digital Learning 200')
        CourseCertificateSignatoriesFactory.create(course=course)

        call_command(
            "alter_data", 'set_past_run_to_passed', '--username', 'staff',
            '--course-title', 'Digital Learning 200', '--grade', '87',
        )
        final_grade = FinalGrade.objects.filter(
            course_run__course__title='Digital Learning 200', user=self.user
        ).first()
        CourseRunGradingStatus.objects.create(course_run=final_grade.course_run, status='complete')
        MicromastersCourseCertificateFactory.create(user=self.user, course=course)

        course_run = CourseRunFactory.create(course=course)
        set_course_run_current(course_run, upgradeable=True, save=True)
        CachedEnrollmentHandler(self.user).set_or_create(course_run, verified=False)
Пример #4
0
def test_valid_certificate_200(client):
    """Test that a request for a valid certificate with signatories results in a 200"""
    certificate = MicromastersCourseCertificateFactory.create()
    signatory = CourseCertificateSignatoriesFactory.create(course=certificate.course)
    resp = client.get(certificate_url(certificate.hash))
    assert resp.status_code == status.HTTP_200_OK
    assert is_subset_dict(
        {
            'certificate_hash': certificate.hash,
            'course_title': certificate.course.title,
            'program_title': certificate.course.program.title,
            'name': certificate.user.profile.full_name,
            'signatories': [signatory],
            'certificate': certificate
        },
        resp.context_data
    )
    assert reverse('certificate', args=[certificate.hash]) in resp.content.decode('utf-8')
Пример #5
0
def test_valid_certificate_200(client):
    """Test that a request for a valid certificate with signatories results in a 200"""
    certificate = MicromastersCourseCertificateFactory.create()
    signatory = CourseCertificateSignatoriesFactory.create(
        course=certificate.course)
    resp = client.get(certificate_url(certificate.hash))
    assert resp.status_code == status.HTTP_200_OK
    assert is_subset_dict(
        {
            'certificate_hash': certificate.hash,
            'course_title': certificate.course.title,
            'program_title': certificate.course.program.title,
            'name': certificate.user.profile.full_name,
            'signatories': [signatory],
            'certificate': certificate
        }, resp.context_data)
    assert reverse('certificate',
                   args=[certificate.hash]) in resp.content.decode('utf-8')