feat(Payments): Generate cash payment with purchase.

This commit is contained in:
2024-08-17 16:39:29 -05:00
parent 1f37e57e00
commit 0c95c21666
3 changed files with 35 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ class TestPurchaseWithPayment(TestCase):
quantity = 2
unit_price = 2500
total = 5000
response = self.client.post(
self.client.post(
'/don_confiao/comprar',
{
"customer": str(self.customer.id),
@@ -42,6 +42,10 @@ class TestPurchaseWithPayment(TestCase):
"payment_method": "CASH",
}
)
purchases = Sale.objects.all()
self.assertEqual(1, len(purchases))
payments = Payment.objects.all()
self.assertEqual(1, len(payments))
self.assertEqual(total, payments[0].amount)
self.assertEqual('CASH', payments[0].type_payment)