def test_pdf(self): """Ensure the pdf method returns the file correctly""" invoice = Invoice(424) invoice.pdf_file = 'tests/invoices/pdf_test.pdf' with self.app.app_context(): response = invoice.pdf() with open('tests/invoices/pdf_test.pdf', 'rb') as f: self.assertEqual(f.read(), response[0]) invoice.delete_pdf()