'test stored fields'

def test_11_stored(self):

    def check_stored(disc):
        '    Check    the    stored    computed    field    on    disc.messages    '
        for msg in disc.messages:
            self.assertEqual(msg.name, ('[%s]    %s' % (disc.name, msg.author.name)))
    discussion1 = self.env.ref('test_new_api.discussion_0')
    self.assertTrue(discussion1.messages)
    check_stored(discussion1)
    discussion1.name = 'Talking    about    stuff...'
    check_stored(discussion1)
    discussion2 = discussion1.copy({'name': 'Another    discussion'})
    message2 = discussion1.messages[0]
    message2.discussion = discussion2
    check_stored(discussion2)
    user_root = self.env.ref('base.user_root')
    user_demo = self.env.ref('base.user_demo')
    discussion3 = self.env['test_new_api.discussion'].create({'name': 'Stuff', 'participants': [(4, user_root.id), (4, user_demo.id)], 'messages': [(0, 0, {'author': user_root.id, 'body': 'one'}), (0, 0, {'author': user_demo.id, 'body': 'two'}), (0, 0, {'author': user_root.id, 'body': 'three'})]})
    check_stored(discussion3)
    discussion3.write({'messages': [(4, discussion3.messages[0].id), (1, discussion3.messages[1].id, {'author': user_root.id}), (2, discussion3.messages[2].id)]})
    check_stored(discussion3)
