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)
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)
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)
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)
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()
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")
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)
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)
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()
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")