Example #1
0
    def test_certificate_generation_history(self):
        """
        Tests that a new record is added whenever certificate generation/regeneration task is submitted.
        """
        instructor_task = generate_certificates_for_students(
            self.create_task_request(self.instructor), self.course.id)
        certificate_generation_history = CertificateGenerationHistory.objects.filter(
            course_id=self.course.id,
            generated_by=self.instructor,
            instructor_task=instructor_task,
            is_regeneration=False)

        # Validate that record was added to CertificateGenerationHistory
        assert certificate_generation_history.exists()

        instructor_task = regenerate_certificates(
            self.create_task_request(self.instructor), self.course.id,
            [CertificateStatuses.downloadable, CertificateStatuses.generating])
        certificate_generation_history = CertificateGenerationHistory.objects.filter(
            course_id=self.course.id,
            generated_by=self.instructor,
            instructor_task=instructor_task,
            is_regeneration=True)

        # Validate that record was added to CertificateGenerationHistory
        assert certificate_generation_history.exists()
Example #2
0
    def test_certificate_generation_history(self):
        """
        Tests that a new record is added whenever certificate generation/regeneration task is submitted.
        """
        instructor_task = generate_certificates_for_students(
            self.create_task_request(self.instructor),
            self.course.id
        )
        certificate_generation_history = CertificateGenerationHistory.objects.filter(
            course_id=self.course.id,
            generated_by=self.instructor,
            instructor_task=instructor_task,
            is_regeneration=False
        )

        # Validate that record was added to CertificateGenerationHistory
        self.assertTrue(certificate_generation_history.exists())

        instructor_task = regenerate_certificates(
            self.create_task_request(self.instructor),
            self.course.id,
            [CertificateStatuses.downloadable, CertificateStatuses.generating]
        )
        certificate_generation_history = CertificateGenerationHistory.objects.filter(
            course_id=self.course.id,
            generated_by=self.instructor,
            instructor_task=instructor_task,
            is_regeneration=True
        )

        # Validate that record was added to CertificateGenerationHistory
        self.assertTrue(certificate_generation_history.exists())
Example #3
0
 def api_call():
     """
     wrapper method for regenerate_certificates
     """
     return regenerate_certificates(
         self.create_task_request(self.instructor), self.course.id, [
             CertificateStatuses.downloadable,
             CertificateStatuses.generating
         ])
Example #4
0
 def api_call():
     """
     wrapper method for regenerate_certificates
     """
     return regenerate_certificates(
         self.create_task_request(self.instructor),
         self.course.id,
         [CertificateStatuses.downloadable, CertificateStatuses.generating]
     )