feat(buy): send products list to buy view.
This commit is contained in:
		
							
								
								
									
										22
									
								
								tienda_ilusion/don_confiao/tests/test_buy_form.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								tienda_ilusion/don_confiao/tests/test_buy_form.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| from django.test import Client, TestCase | ||||
| from ..models import Product | ||||
|  | ||||
|  | ||||
| class TestBuyForm(TestCase): | ||||
|     def setUp(self): | ||||
|         self.client = Client() | ||||
|         self.product = Product() | ||||
|         self.product.name = "Arroz" | ||||
|         self.product.price = 5000 | ||||
|         self.product.save() | ||||
|  | ||||
|     def test_buy_contains_products_list(self): | ||||
|         response = self.client.get('/don_confiao/comprar') | ||||
|         self.assertIn( | ||||
|             self.product.name, | ||||
|             response.context['list_products'] | ||||
|         ) | ||||
|         content = response.content.decode('utf-8') | ||||
|         self.assertIn('5000', content) | ||||
|         self.assertIn('Arroz', content) | ||||
|         self.assertIn(str(self.product.id), content) | ||||
		Reference in New Issue
	
	Block a user