feat: add config option to show/hide Store ID; default value
This commit is contained in:
parent
3ef84ff706
commit
89e3445ace
19 changed files with 445 additions and 64 deletions
|
@ -20,6 +20,16 @@ class TestNewOrderBatchHandler(DataTestCase):
|
|||
def make_handler(self):
|
||||
return mod.NewOrderBatchHandler(self.config)
|
||||
|
||||
def test_get_default_store_id(self):
|
||||
handler = self.make_handler()
|
||||
|
||||
# null by default
|
||||
self.assertIsNone(handler.get_default_store_id())
|
||||
|
||||
# whatever is configured
|
||||
self.config.setdefault('sideshow.orders.default_store_id', '042')
|
||||
self.assertEqual(handler.get_default_store_id(), '042')
|
||||
|
||||
def test_use_local_customers(self):
|
||||
handler = self.make_handler()
|
||||
|
||||
|
@ -108,6 +118,23 @@ class TestNewOrderBatchHandler(DataTestCase):
|
|||
# search for sally finds nothing
|
||||
self.assertEqual(handler.autocomplete_customers_local(self.session, 'sally'), [])
|
||||
|
||||
def test_init_batch(self):
|
||||
model = self.app.model
|
||||
handler = self.make_handler()
|
||||
|
||||
# store_id is null by default
|
||||
batch = handler.model_class()
|
||||
self.assertIsNone(batch.store_id)
|
||||
handler.init_batch(batch)
|
||||
self.assertIsNone(batch.store_id)
|
||||
|
||||
# but default can be configured
|
||||
self.config.setdefault('sideshow.orders.default_store_id', '042')
|
||||
batch = handler.model_class()
|
||||
self.assertIsNone(batch.store_id)
|
||||
handler.init_batch(batch)
|
||||
self.assertEqual(batch.store_id, '042')
|
||||
|
||||
def test_set_customer(self):
|
||||
model = self.app.model
|
||||
handler = self.make_handler()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue