Пример #1
0
    def test_create_based_on_image(self, isfile_mock, cavs_mock, reader_mock):
        certpdf = CertPDF(
            self.fp, self.username, self.course_id,
            self.course_name, self.file_prefix)
        certpdf.create_based_on_image(self.fp)

        isfile_mock.assert_called_once_with(self.fp)
        cavs_mock.Canvas.assert_called_once_with(
            self.fp, bottomup=True, pageCompression=1, pagesize=ANY)
        reader_mock.assert_called_once_with(self.fp)
Пример #2
0
    def test_create_based_on_image(self, isfile_mock, cavs_mock, reader_mock):
        certpdf = CertPDF(self.fp, self.username, self.course_id,
                          self.course_name, self.file_prefix)
        certpdf.create_based_on_image(self.fp)

        isfile_mock.assert_called_once_with(self.fp)
        cavs_mock.Canvas.assert_called_once_with(self.fp,
                                                 bottomup=True,
                                                 pageCompression=1,
                                                 pagesize=ANY)
        reader_mock.assert_called_once_with(self.fp)
Пример #3
0
 def test_create_based_on_image_isnot_image(self, isfile_mock):
     with self.assertRaises(PDFBaseIsNotImage):
         certpdf = CertPDF(
             self.fp, self.username, self.course_id,
             self.course_name, self.file_prefix)
         certpdf.create_based_on_image(self.fp)
Пример #4
0
 def test_create_based_on_image_isnot_image(self, isfile_mock):
     with self.assertRaises(PDFBaseIsNotImage):
         certpdf = CertPDF(self.fp, self.username, self.course_id,
                           self.course_name, self.file_prefix)
         certpdf.create_based_on_image(self.fp)