'Test assignment of many2many field where rules apply.'

def test_many2many(self):

    ids = [self.id1, self.id2]
    container_admin = self.env['test_access_right.container'].create({'some_ids': [(6, 0, ids)]})
    self.assertItemsEqual(container_admin.some_ids.ids, ids)
    container_user = container_admin.sudo(self.browse_ref('base.public_user'))
    self.assertItemsEqual(container_user.some_ids.ids, [self.id1])
    container_user.write({'some_ids': [(6, 0, ids)]})
    self.assertItemsEqual(container_user.some_ids.ids, [self.id1])
    self.assertItemsEqual(container_admin.some_ids.ids, ids)
    container_user.write({'some_ids': [(5,)]})
    self.assertItemsEqual(container_user.some_ids.ids, [])
    self.assertItemsEqual(container_admin.some_ids.ids, [self.id2])
