django(View): add purchase summary json endpoint.

This commit is contained in:
2024-11-02 12:51:26 -05:00
parent 4cbeaa2560
commit 1519b3c8bb
3 changed files with 39 additions and 0 deletions

View File

@@ -32,3 +32,10 @@ class TestSummaryViewPurchase(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context["purchase"].customer, self.purchase.customer)
self.assertIn('Alejo Mono', response.content.decode('utf-8'))
def test_json_summary(self):
response = self.client.get(f"/don_confiao/resumen_compra_json/{self.purchase.id}")
self.assertEqual(response.status_code, 200)
self.assertIn('Alejo Mono', response.content.decode('utf-8'))
self.assertIn('cafe', response.content.decode('utf-8'))
self.assertIn('72500', response.content.decode('utf-8'))