'Check the cron creates the necessary preventive maintenance requests'

def test_20_cron(self):

    equipment_cron = 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_request_cron = self.maintenance_request.create({'name': 'Need    a    special    calibration', 'technician_user_id': self.user.id, 'request_date': (datetime.datetime.now() + relativedelta.relativedelta(days=7)).strftime('%Y-%m-%d'), 'maintenance_type': 'preventive', 'owner_user_id': self.user.id, 'equipment_id': equipment_cron.id, 'color': 7, 'stage_id': self.ref('maintenance.stage_0'), 'maintenance_team_id': self.ref('maintenance.equipment_team_maintenance')})
    self.env['maintenance.equipment']._cron_generate_requests()
    tot_requests = self.maintenance_request.search([('equipment_id', '=', equipment_cron.id)])
    self.assertEqual(len(tot_requests), 1, 'The    cron    should    have    generated    just    1    request    for    the    High    Maintenance    Monitor.')
