Example #1
0
 def test_with_one_filled_pdf(self, get_parser):
     filled_pdf = factories.FilledPDFFactory()
     PDFService.set_bytes_to_filled_pdfs(self.instance, [filled_pdf])
     get_parser.assert_not_called()
     self.assertTrue(self.instance.pdf)
     filled_pdf.pdf.seek(0)
     self.assertEqual(self.instance.pdf.read(), filled_pdf.pdf.read())
 def test_with_one_filled_pdf(self, get_parser):
     filled_pdf = factories.FilledPDFFactory()
     PDFService.set_bytes_to_filled_pdfs(self.instance, [filled_pdf])
     get_parser.assert_not_called()
     self.assertTrue(self.instance.pdf)
     filled_pdf.pdf.seek(0)
     self.assertEqual(self.instance.pdf.read(), filled_pdf.pdf.read())
Example #3
0
 def test_with_multiple_filled_pdfs(self, get_parser):
     get_parser.return_value.join_pdfs.return_value = b'joined pdf'
     filled_pdfs = factories.FilledPDFFactory.create_batch(2)
     PDFService.set_bytes_to_filled_pdfs(self.instance, filled_pdfs)
     self.assertEqual(self.instance.pdf.read(), b'joined pdf')
Example #4
0
 def test_with_no_filled_pdfs(self, get_parser):
     PDFService.set_bytes_to_filled_pdfs(self.instance, [])
     self.assertFalse(self.instance.pdf)
     self.assertEqual(self.instance.pdf, None)
     get_parser.assert_not_called()
 def test_with_multiple_filled_pdfs(self, get_parser):
     get_parser.return_value.join_pdfs.return_value = b'joined pdf'
     filled_pdfs = factories.FilledPDFFactory.create_batch(2)
     PDFService.set_bytes_to_filled_pdfs(self.instance, filled_pdfs)
     self.assertEqual(self.instance.pdf.read(), b'joined pdf')
 def test_with_no_filled_pdfs(self, get_parser):
     PDFService.set_bytes_to_filled_pdfs(self.instance, [])
     self.assertFalse(self.instance.pdf)
     self.assertEqual(self.instance.pdf, None)
     get_parser.assert_not_called()