Add test call to on_change methods
- Manage None as value of field in on_change method issue6069 review27851002
This commit is contained in:
+2
-1
@@ -37,7 +37,8 @@ class Note(ResourceMixin, ModelSQL, ModelView):
|
||||
@fields.depends('message')
|
||||
def on_change_with_message_wrapped(self, name=None):
|
||||
wrapper = self.get_wrapper()
|
||||
return '\n'.join(map(wrapper.fill, self.message.splitlines()))
|
||||
message = self.message or ''
|
||||
return '\n'.join(map(wrapper.fill, message.splitlines()))
|
||||
|
||||
@classmethod
|
||||
def get_unread(cls, ids, name):
|
||||
|
||||
@@ -305,6 +305,12 @@ class ModuleTestCase(unittest.TestCase):
|
||||
elif attr.startswith('order_'):
|
||||
tables = {None: (model.__table__(), None)}
|
||||
getattr(model, attr)(tables)
|
||||
elif any(attr.startswith(p) for p in [
|
||||
'on_change_',
|
||||
'on_change_with_',
|
||||
'autocomplete_']):
|
||||
record = model()
|
||||
getattr(record, attr)()
|
||||
|
||||
@with_transaction()
|
||||
def test_menu_action(self):
|
||||
|
||||
Reference in New Issue
Block a user