feat(buy): send products list to buy view.

This commit is contained in:
2024-08-31 09:46:03 -05:00
parent 23ec2bc298
commit f1d96467d6
3 changed files with 35 additions and 1 deletions

View 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)