Pruebas unitarias para los modelos de carrito y pedidos
Definition at line 8 of file test_cart_models.py.
◆ setUp()
test_cart_models.CartModelTests.setUp |
( |
| self | ) |
|
◆ test_creacion_detalle_pedido()
test_cart_models.CartModelTests.test_creacion_detalle_pedido |
( |
| self | ) |
|
Verifica que un detalle de pedido se crea correctamente y calcula el subtotal
Definition at line 74 of file test_cart_models.py.
◆ test_creacion_pedido()
test_cart_models.CartModelTests.test_creacion_pedido |
( |
| self | ) |
|
◆ test_modificar_estado_pedido()
test_cart_models.CartModelTests.test_modificar_estado_pedido |
( |
| self | ) |
|
Verifica que se puede modificar el estado de un pedido
Definition at line 83 of file test_cart_models.py.
◆ carrito
test_cart_models.CartModelTests.carrito |
Initial value:= Carrito.objects.create(
producto=self.producto,
cantidad=2,
usuario=self.usuario,
comprado=False,
id_pedido=self.pedido
)
Definition at line 59 of file test_cart_models.py.
◆ categoria
test_cart_models.CartModelTests.categoria |
Initial value:= CategoriaProducto.objects.create(
nombre_categoria='Hamburguesas',
descripcion='Hamburguesas clásicas'
)
Definition at line 25 of file test_cart_models.py.
◆ detalle_pedido
test_cart_models.CartModelTests.detalle_pedido |
Initial value:= DetallePedido.objects.create(
id_pedido=self.pedido,
id_producto=self.producto,
cantidad_productos=2,
precio_producto=self.producto.precio,
subtotal=self.producto.precio * 2,
direccion_entrega=self.pedido.direccion_entrega
)
Definition at line 49 of file test_cart_models.py.
◆ pedido
test_cart_models.CartModelTests.pedido |
Initial value:= Pedido.objects.create(
id_usuario=self.usuario,
fecha_pedido=date.today(),
direccion_entrega=self.usuario.direccion,
estado='Pendiente'
)
Definition at line 41 of file test_cart_models.py.
◆ producto
test_cart_models.CartModelTests.producto |
Initial value:= Producto.objects.create(
nombre_producto='Hamburguesa clásica',
descripcion='Hamburguesa con queso, lechuga y tomate',
precio=500.0,
stock=10,
imageURL='hamburguesa.jpg',
id_categoria=self.categoria
)
Definition at line 31 of file test_cart_models.py.
◆ usuario
test_cart_models.CartModelTests.usuario |
Initial value:= Usuario.objects.create_user(
email='cliente@example.com',
password='password123',
nombre='Cliente',
apellido='Test',
telefono='1234567890',
direccion='Calle Falsa 123'
)
Definition at line 15 of file test_cart_models.py.
The documentation for this class was generated from the following file: