def test_receipt_find_by_id(session): """Assert a invoice is stored. Start with a blank database. """ payment_account = factory_payment_account() payment = factory_payment() payment_account.save() payment.save() invoice = factory_invoice(payment_id=payment.id, account_id=payment_account.id) invoice = invoice.save() receipt = Receipt() receipt.receipt_amount = 100 receipt.receipt_date = datetime.now() receipt.invoice_id = invoice.id receipt.receipt_number = '123451' receipt = receipt.save() receipt = receipt.find_by_id(receipt.id) assert receipt is not None receipt = receipt.find_by_invoice_id_and_receipt_number( invoice.id, '123451') assert receipt is not None receipt = receipt.find_by_invoice_id_and_receipt_number(invoice.id, None) assert receipt is not None
def test_receipt(session): """Assert a receipt is stored. Start with a blank database. """ payment_account = factory_payment_account() payment = factory_payment() payment_account.save() payment.save() invoice = factory_invoice(payment_account=payment_account) invoice = invoice.save() receipt = Receipt() receipt.receipt_amount = 100 receipt.receipt_date = datetime.now() receipt.invoice_id = invoice.id receipt.receipt_number = '123451' receipt = receipt.save() assert receipt.id is not None