'test the effect of field-specific onchange method'

def test_onchange_specific(self):

    discussion = self.env.ref('test_new_api.discussion_0')
    demo = self.env.ref('base.user_demo')
    field_onchange = self.Discussion._onchange_spec()
    self.assertEqual(field_onchange.get('moderator'), '1')
    self.assertItemsEqual(strip_prefix('participants.', field_onchange), ['display_name'])
    discussion.participants -= demo
    self.assertNotIn(demo, discussion.participants)
    values = {'name': discussion.name, 'moderator': demo.id, 'categories': [(4, cat.id) for cat in discussion.categories], 'messages': [(4, msg.id) for msg in discussion.messages], 'participants': [(4, usr.id) for usr in discussion.participants]}
    self.env.invalidate_all()
    result = discussion.onchange(values, 'moderator', field_onchange)
    self.assertIn('participants', result['value'])
    self.assertItemsEqual(result['value']['participants'], ([(5,)] + [(1, user.id, {'display_name': user.display_name}) for user in (discussion.participants + demo)]))
