#69 feat(ReconciliationJar): add purchases to list.
This commit is contained in:
@@ -4,6 +4,7 @@ from ..models import Sale, Product, SaleLine, Customer, ReconciliationJar
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class TestJarReconcliation(TestCase):
|
||||
def setUp(self):
|
||||
customer = Customer()
|
||||
@@ -114,12 +115,18 @@ class TestJarReconcliation(TestCase):
|
||||
|
||||
def test_create_reconciliation_with_purchases(self):
|
||||
url = '/don_confiao/reconciliation_jar/create'
|
||||
total_purchases = (11 * 72500) + (27 * 72500)
|
||||
data = {
|
||||
'date_time': '2024-12-02T21:07',
|
||||
'cashman': 'carlos',
|
||||
'total_cash_purchases': 45000,
|
||||
'cash_taken': 44000,
|
||||
'cash_discrepancy': 1000,
|
||||
'total_cash_purchases': total_purchases,
|
||||
'cash_taken': total_purchases,
|
||||
'cash_discrepancy': 0,
|
||||
'purchases': json.dumps([#machete por error al codificar el json en el request
|
||||
self.purchase.id,
|
||||
self.purchase2.id,
|
||||
self.purchase.id,
|
||||
]),
|
||||
}
|
||||
response = self.client.post(url, data, format='json')
|
||||
rawContent = response.content.decode('utf-8')
|
||||
@@ -128,6 +135,9 @@ class TestJarReconcliation(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('id', content)
|
||||
|
||||
purchases = Sale.objects.filter(reconciliation_id=content['id'])
|
||||
self.assertEqual(len(purchases), 2)
|
||||
|
||||
def _create_simple_reconciliation(self):
|
||||
reconciliation = ReconciliationJar()
|
||||
reconciliation.date_time = "2024-07-30"
|
||||
|
||||
Reference in New Issue
Block a user