'Check the creation of maintenance requests by the cron'

def test_21_cron(self):

    team_test = self.maintenance_team.create({'name': 'team_test'})
    equipment = self.equipment.create({'name': 'High    Maintenance    Monitor    because    of    Color    Calibration', 'category_id': self.ref('maintenance.equipment_monitor'), 'technician_user_id': self.ref('base.user_root'), 'owner_user_id': self.user.id, 'assign_date': time.strftime('%Y-%m-%d'), 'period': 7, 'color': 3, 'maintenance_team_id': team_test.id, 'maintenance_duration': 3.0})
    self.env['maintenance.equipment']._cron_generate_requests()
    tot_requests = self.maintenance_request.search([('equipment_id', '=', equipment.id)])
    self.assertEqual(len(tot_requests), 1, 'The    cron    should    have    generated    just    1    request    for    the    High    Maintenance    Monitor.')
    self.assertEqual(tot_requests.maintenance_team_id.id, team_test.id, 'The    maintenance    team    should    be    the    same    as    equipment    one')
    self.assertEqual(tot_requests.duration, 3.0, 'Equipement    maintenance    duration    is    not    the    same    as    the    request    one')
