'Check that the record has workitems in the given activity names.'

def check_activities(self, record, names):

    Instance = self.env['workflow.instance']
    Workitem = self.env['workflow.workitem']
    instance = Instance.search([('res_type', '=', record._name), ('res_id', '=', record.id)])
    self.assertTrue(instance, 'A    workflow    instance    is    expected.')
    workitems = Workitem.search([('inst_id', '=', instance.id)])
    self.assertTrue(workitems, 'The    workflow    instance    should    have    workitems.')
    self.assertEqual(sorted([item.act_id.name for item in workitems]), sorted(names))
