'https://github.com/naparuba/shinken/issues/1385'

def test_issue_1385(self):

    tp = Timeperiod()
    tp.timeperiod_name = 'mercredi2-22-02'
    tp.resolve_daterange(tp.dateranges, 'wednesday    2                                                        00:00-02:00,22:00-24:00')
    tp.resolve_daterange(tp.dateranges, 'thursday    2                                                                00:00-02:00,22:00-24:00')
    valid_times = ((2014, 11, 12, 1, 0), (2014, 11, 12, 23, 0), (2014, 11, 13, 0, 0), (2014, 12, 10, 1, 0), (2014, 12, 10, 23, 0), (2014, 12, 11, 1, 0), (2014, 12, 11, 23, 0))
    for valid in valid_times:
        dt = datetime.datetime(*valid)
        valid_tm = time.mktime(dt.timetuple())
        self.assertTrue(tp.is_time_valid(valid_tm))
    invalid_times = ((2014, 11, 3, 1, 0), (2014, 11, 4, 1, 0), (2014, 11, 17, 1, 0), (2014, 11, 18, 1, 0), (2014, 12, 5, 3, 0), (2014, 12, 17, 1, 0), (2014, 12, 18, 1, 0), (2014, 12, 24, 1, 0), (2014, 12, 25, 1, 0), (2014, 12, 31, 1, 0))
    for invalid in invalid_times:
        dt = datetime.datetime(*invalid)
        invalid_tm = time.mktime(dt.timetuple())
        self.assertFalse(tp.is_time_valid(invalid_tm))
