fix: customize "view order item" page w/ panels

more to come soon..
This commit is contained in:
Lance Edgar 2025-01-15 16:57:28 -06:00
parent 13d576295e
commit c79b0262f3
9 changed files with 403 additions and 32 deletions

40
tests/test_orders.py Normal file
View file

@ -0,0 +1,40 @@
# -*- coding: utf-8; -*-
from wuttjamaican.testing import DataTestCase
from sideshow import orders as mod
class TestOrderHandler(DataTestCase):
def make_config(self, **kwargs):
config = super().make_config(**kwargs)
config.setdefault('wutta.enum_spec', 'sideshow.enum')
return config
def make_handler(self):
return mod.OrderHandler(self.config)
def test_get_order_qty_uom_text(self):
enum = self.app.enum
handler = self.make_handler()
# typical, plain text
text = handler.get_order_qty_uom_text(2, enum.ORDER_UOM_CASE, case_size=12)
self.assertEqual(text, "2 Cases (x 12 = 24 Units)")
# typical w/ html
text = handler.get_order_qty_uom_text(2, enum.ORDER_UOM_CASE, case_size=12, html=True)
self.assertEqual(text, "2 Cases (× 12 = 24 Units)")
# unknown case size
text = handler.get_order_qty_uom_text(2, enum.ORDER_UOM_CASE)
self.assertEqual(text, "2 Cases (x ?? = ?? Units)")
text = handler.get_order_qty_uom_text(2, enum.ORDER_UOM_CASE, html=True)
self.assertEqual(text, "2 Cases (× ?? = ?? Units)")
# units only
text = handler.get_order_qty_uom_text(2, enum.ORDER_UOM_UNIT)
self.assertEqual(text, "2 Units")
text = handler.get_order_qty_uom_text(2, enum.ORDER_UOM_UNIT, html=True)
self.assertEqual(text, "2 Units")