'test prefetch of records handle AccessError'

def test_31_prefetch(self):

    Category = self.env['test_new_api.category']
    cat1 = Category.create({'name': 'NOACCESS'})
    cat2 = Category.create({'name': 'ACCESS', 'parent': cat1.id})
    cats = (cat1 + cat2)
    self.env.clear()
    (cat1, cat2) = cats
    self.assertEqual(cat2.name, 'ACCESS')
    self.assertItemsEqual(cat2._prefetch[Category._name], cats.ids)
    self.assertFalse(cat2.discussions)
    self.assertEqual(cat2.parent, cat1)
    with self.assertRaises(AccessError):
        cat1.name
