Exemple #1
0
    def test_create_not_ended(self, students_mock, course_mock, request_mock):
        course_mock().has_ended = lambda: False
        with self.assertRaises(CertPDFException) as e:
            cert = CertificatePDF(self.user, self.course_id, self.debug,
                                  self.noop, self.file_prefix, self.exclude)
            cert.create()

        self.assertEqual(e.exception.message, 'This couse is not ended.')
        students_mock.assert_called_once_with()
        course_mock.assert_called_with(self.course_id)
        request_mock.assert_called_once_with()
    def test_create_not_ended(self, students_mock, course_mock, request_mock):
        course_mock().has_ended = lambda: False
        with self.assertRaises(CertPDFException) as e:
            cert = CertificatePDF(self.user, self.course_id, self.debug,
                                  self.noop, self.file_prefix, self.exclude)
            cert.create()

        self.assertEqual(e.exception.message, 'This couse is not ended.')
        students_mock.assert_called_once_with()
        course_mock.assert_called_with(self.course_id)
        request_mock.assert_called_once_with()
    def test_create(self, students_mock, course_mock, request_mock, pdf_mock):
        students_mock().iterator.return_value = itertools.repeat(self.student, 1)
        course_mock().has_ended.return_value = True

        cert = CertificatePDF(self.user, self.course_id, self.debug,
                              self.noop, self.file_prefix, self.exclude)
        cert.create()

        students_mock.assert_called_with()
        course_mock.assert_called_with(self.course_id)
        request_mock.assert_called_once_with()
        pdf_mock.assert_called_once_with(self.student, request_mock(), course_mock())
Exemple #4
0
    def test_create(self, students_mock, course_mock, request_mock, pdf_mock):
        students_mock().iterator.return_value = itertools.repeat(
            self.student, 1)
        course_mock().has_ended.return_value = True

        cert = CertificatePDF(self.user, self.course_id, self.debug, self.noop,
                              self.file_prefix, self.exclude)
        cert.create()

        students_mock.assert_called_with()
        course_mock.assert_called_with(self.course_id)
        request_mock.assert_called_once_with()
        pdf_mock.assert_called_once_with(self.student, request_mock(),
                                         course_mock())