コード例 #1
0
 def test_build(self):
     """Builds a PDF and ensures it was properly created"""
     invoice = Invoice(424)
     invoice.pdf_file = 'tests/invoices/build_test.pdf'
     with self.app.app_context():
         invoice.build_pdf()
     self.assertTrue(os.path.isfile('tests/invoices/build_test.pdf'))
     invoice.delete_pdf()
コード例 #2
0
 def test_delete_pdf(self):
     """Ensure that a PDF was deleted by checking the file path"""
     invoice = Invoice(424)
     invoice.pdf_file = 'tests/invoices/delete_test.pdf'
     with self.app.app_context():
         invoice.build_pdf()
     invoice.delete_pdf()
     self.assertFalse(os.path.isfile('tests/invoices/build_test.pdf'))