Exemplo n.º 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()
Exemplo n.º 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())
Exemplo n.º 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
         ])
Exemplo n.º 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]
     )