#51 feat: agregar descripcion, nombre alternativo y activo a categorias de productos
Issue #51: discriminacion y administracion de categorias de productos. - ProductCategory.description (TextField blank) - ProductCategory.alternative_name (CharField 100 nullable) - ProductCategory.active (Boolean default True) - Migracion 0056_productcategory_active_and_more - Tests de modelo (campo don confiao y active por defecto)
This commit is contained in:
25
tienda_ilusion/don_confiao/tests/test_product_categories.py
Normal file
25
tienda_ilusion/don_confiao/tests/test_product_categories.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from ..models.products import ProductCategory
|
||||
|
||||
|
||||
class TestProductCategoryModel(TestCase):
|
||||
def test_create_category_with_don_confiao_fields(self):
|
||||
category = ProductCategory.objects.create(
|
||||
name="Bebidas",
|
||||
external_id="8",
|
||||
description="Bebidas y jugos naturales",
|
||||
alternative_name="Jugos",
|
||||
active=False,
|
||||
)
|
||||
self.assertEqual(category.name, "Bebidas")
|
||||
self.assertEqual(category.external_id, "8")
|
||||
self.assertEqual(category.description, "Bebidas y jugos naturales")
|
||||
self.assertEqual(category.alternative_name, "Jugos")
|
||||
self.assertFalse(category.active)
|
||||
|
||||
def test_category_active_por_defecto(self):
|
||||
category = ProductCategory.objects.create(name="Granos")
|
||||
self.assertTrue(category.active)
|
||||
self.assertEqual(category.description, "")
|
||||
self.assertIsNone(category.alternative_name)
|
||||
Reference in New Issue
Block a user