diff --git a/tienda_ilusion/don_confiao/tests/test_jar_reconciliation.py b/tienda_ilusion/don_confiao/tests/test_jar_reconciliation.py index 8397cbc..72899a3 100644 --- a/tienda_ilusion/don_confiao/tests/test_jar_reconciliation.py +++ b/tienda_ilusion/don_confiao/tests/test_jar_reconciliation.py @@ -113,6 +113,30 @@ class TestJarReconcliation(TestCase): reconciliation.clean() reconciliation.save() + def test_fail_create_reconciliation_with_wrong_total_purchases_purchases(self): + url = '/don_confiao/reconciliation_jar/create' + total_purchases = (11 * 72500) + (27 * 72500) + bad_total_purchases = total_purchases + 2 + data = { + 'date_time': '2024-12-02T21:07', + 'cashman': 'carlos', + 'total_cash_purchases': bad_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') + content = json.loads(rawContent) + + self.assertEqual(response.status_code, 400) + self.assertIn('error', content) + self.assertIn('total_cash_purchases', content['error']) + def test_create_reconciliation_with_purchases(self): url = '/don_confiao/reconciliation_jar/create' total_purchases = (11 * 72500) + (27 * 72500)