Add Summary View Purchase
This commit is contained in:
		| @@ -0,0 +1,31 @@ | ||||
| from django.test import TestCase, Client | ||||
| from ..models import Sale, Product, SaleLine | ||||
|  | ||||
| class TestSummaryViewPurchase(TestCase): | ||||
|     def setUp(self): | ||||
|         self.client = Client() | ||||
|         purchase = Sale() | ||||
|         purchase.customer = "Alejo Mono" | ||||
|         purchase.date = "2024-07-30" | ||||
|         purchase.clean() | ||||
|         purchase.save() | ||||
|          | ||||
|         product = Product() | ||||
|         product.name = "cafe" | ||||
|         product.price = "72500" | ||||
|         product.save() | ||||
|          | ||||
|         line = SaleLine() | ||||
|         line.sale = purchase | ||||
|         line.product = product | ||||
|         line.quantity = "2" | ||||
|         line.unit_price = "72500" | ||||
|         line.save() | ||||
|         self.purchase = purchase | ||||
|          | ||||
|     def test_summary_has_customer(self): | ||||
|         response = self.client.get("/don_confiao/resumen_compra/" + str(self.purchase.id)) | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|         self.assertEqual(response.context["purchase"].customer, self.purchase.customer) | ||||
|         self.assertIn('Alejo Mono', response.content.decode('utf-8')) | ||||
|          | ||||
		Reference in New Issue
	
	Block a user