tests: fix test for orders / configure_form()
This commit is contained in:
parent
6d884bccc3
commit
e7a5f6c09e
|
@ -1074,11 +1074,11 @@ class TestOrderView(WebTestCase):
|
|||
local = model.LocalCustomer(first_name='Jack', last_name='Black',
|
||||
phone_number='555-1234')
|
||||
self.session.add(local)
|
||||
order.local_customer = local
|
||||
self.session.flush()
|
||||
|
||||
# viewing (local customer)
|
||||
with patch.object(view, 'viewing', new=True):
|
||||
with patch.object(order, 'local_customer', new=local):
|
||||
form = view.make_form(model_instance=order)
|
||||
# nb. this is to avoid include/exclude ambiguity
|
||||
form.remove('items')
|
||||
|
@ -1087,6 +1087,15 @@ class TestOrderView(WebTestCase):
|
|||
schema = form.get_schema()
|
||||
self.assertIsInstance(schema['total_price'].typ, WuttaMoney)
|
||||
|
||||
# local customer is hidden if missing when customer_id is set
|
||||
with patch.object(view, 'viewing', new=True):
|
||||
with patch.object(order, 'customer_id', new='42'):
|
||||
form = view.make_form(model_instance=order)
|
||||
# nb. this is to avoid include/exclude ambiguity
|
||||
form.remove('items')
|
||||
view.configure_form(form)
|
||||
self.assertNotIn('local_customer', form)
|
||||
|
||||
def test_get_xref_buttons(self):
|
||||
self.pyramid_config.add_route('neworder_batches.view', '/batch/neworder/{uuid}')
|
||||
model = self.app.model
|
||||
|
|
Loading…
Reference in a new issue