From 82a6273b3d238c378712d2b461af0c007f9bf694 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 11 Feb 2021 13:29:06 +0000 Subject: [PATCH] increased tag count in product model --- products/models.py | 4 ++-- products/tests.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/products/models.py b/products/models.py index c4d2538..8fce915 100644 --- a/products/models.py +++ b/products/models.py @@ -32,9 +32,9 @@ class Product(models.Model): update_date = models.DateTimeField('Fecha de actualización de producto', null=True, blank=True) discount = models.DecimalField('Descuento', max_digits=5, decimal_places=2, null=True, blank=True) stock = models.PositiveIntegerField('Stock', null=True) - tags = TagField(force_lowercase=True,max_count=5, tree=True) + tags = TagField(force_lowercase=True, max_count=20, tree=True) category = SingleTagField(null=True) # main tag category - attributes = TagField(force_lowercase=True,max_count=5, tree=True) + attributes = TagField(force_lowercase=True, max_count=20, tree=True) identifiers = models.TextField('Identificador único de producto', null=True, blank=True) # internal diff --git a/products/tests.py b/products/tests.py index 092ecd2..12eee20 100644 --- a/products/tests.py +++ b/products/tests.py @@ -368,20 +368,24 @@ class ProductSearchTest(TestCase): self.model = Product self.factory = ProductFactory # create admin user - self.admin_email = f"admin_user@mail.com" + self.admin_email = "admin_user@mail.com" self.password = ''.join(random.choices(string.ascii_uppercase, k = 10)) self.admin_user = CustomUserFactory(email=self.admin_email, password=self.password, is_staff=True, is_active=True) # create regular user - self.reg_email = f"user@mail.com" + self.reg_email = "user@mail.com" self.user = CustomUserFactory(email=self.reg_email, is_active=True) self.user.set_password(self.password) self.user.save() def test_anon_user_can_search(self): expected_instances = [ - self.factory(description="zapatos"), + self.factory(description="zapatos verdes"), self.factory(tags="rojos"), ] + unexpected_instances = [ + self.factory(description="chanclas"), + self.factory(tags="azules"), + ] self.factory(tags="azul") @@ -390,7 +394,7 @@ class ProductSearchTest(TestCase): url = f"{self.endpoint}?query_string={query_string}" # send in request response = self.client.get(url) - # check re sponse + # check response self.assertEqual(response.status_code, 200) # check for object creation self.assertEquals(len(response.data['products']), len(expected_instances))