Example #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)
Example #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)
Example #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)
Example #4
0
 def test_create_based_on_pdf_not_exists(self, isfile_mock):
     with self.assertRaises(PDFBaseNotFound):
         certpdf = CertPDF(
             self.fp, self.username, self.course_id,
             self.course_name, self.file_prefix)
         certpdf.create_based_on_pdf(self.fp)
Example #5
0
 def test_create_pdf_directory_not_found(self):
     with self.assertRaises(PDFBaseNotFound):
         certpdf = CertPDF(
             self.fp, self.username, self.course_id,
             self.course_name, self.file_prefix)
         certpdf.create_pdf()
Example #6
0
 def test_create_pdf(self, pdf_mock):
     certpdf = CertPDF(
         self.fp, self.username, self.course_id,
         self.course_name, self.file_prefix)
     certpdf.create_pdf()
     pdf_mock.assert_called_once_with("/tmp/prefix-org-num-run.pdf")
Example #7
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)
Example #8
0
 def test_create_based_on_pdf_not_exists(self, isfile_mock):
     with self.assertRaises(PDFBaseNotFound):
         certpdf = CertPDF(self.fp, self.username, self.course_id,
                           self.course_name, self.file_prefix)
         certpdf.create_based_on_pdf(self.fp)
Example #9
0
 def test_create_pdf_directory_not_found(self):
     with self.assertRaises(PDFBaseNotFound):
         certpdf = CertPDF(self.fp, self.username, self.course_id,
                           self.course_name, self.file_prefix)
         certpdf.create_pdf()
Example #10
0
 def test_create_pdf(self, pdf_mock):
     certpdf = CertPDF(self.fp, self.username, self.course_id,
                       self.course_name, self.file_prefix)
     certpdf.create_pdf()
     pdf_mock.assert_called_once_with("/tmp/prefix-org-num-run.pdf")