def test_validate_dates_first_holiday(self): first_holiday = ACPHoliday.objects.all().first() last_holiday = ACPHoliday.objects.all().last() try: ACPHoliday.validate_dates(first_holiday.date - datetime.timedelta(days=1), last_holiday.date) self.fail('Value error should have been raised') except ValueError as e: self.assertEqual('Start date precedes the first registered holiday', str(e))
def test_validate_dates_first_holiday(self): first_holiday = ACPHoliday.objects.all().first() last_holiday = ACPHoliday.objects.all().last() try: ACPHoliday.validate_dates(first_holiday.date - datetime.timedelta(days=1), last_holiday.date) self.fail('Value error should have been raised') except ACPCalendarException as e: self.assertEqual('Start date precedes the first registered holiday', str(e))
def test_validate_dates_last_holiday(self): first_holiday = ACPHoliday.objects.all().first() last_holiday = ACPHoliday.objects.all().last() try: ACPHoliday.validate_dates(first_holiday.date, last_holiday.date + datetime.timedelta(days=1)) self.fail('Value error should have been raised') except ValueError as e: self.assertEqual('End date exceed the last registered holiday', str(e))
def test_validate_dates_last_holiday(self): first_holiday = ACPHoliday.objects.all().first() last_holiday = ACPHoliday.objects.all().last() try: ACPHoliday.validate_dates( first_holiday.date, last_holiday.date + datetime.timedelta(days=1)) self.fail('Value error should have been raised') except ValueError as e: self.assertEqual('End date exceed the last registered holiday', str(e))