예제 #1
0
    def is_future_date(self):
        """Checks if the array of day, month and year strings represents a date in the future."""
        day = self.data[0]
        month = self.data[1]
        year = self.data[2]

        default_message = '{} was not the current date or in the past'.format(
            self.display_name)

        if not CommonValidator.is_future_date(day, month, year):
            self.validation_error_builder.add_error(self, default_message)

        return self
예제 #2
0
    def test_is_future_date_with_invalid_date(self):
        result = CommonValidator.is_future_date(INVALID_DAY, INVALID_MONTH,
                                                INVALID_YEAR)

        self.assertFalse(result)
예제 #3
0
    def test_is_future_date_with_past_date(self):
        result = CommonValidator.is_future_date(VALID_DAY, VALID_MONTH,
                                                VALID_PAST_DATE)

        self.assertFalse(result)
예제 #4
0
    def test_is_future_date_with_current_date(self):
        result = CommonValidator.is_future_date(CURRENT_DAY, CURRENT_MONTH,
                                                CURRENT_YEAR)

        self.assertFalse(result)
예제 #5
0
    def test_is_future_date_with_future_date(self):
        result = CommonValidator.is_future_date(VALID_DAY, VALID_MONTH,
                                                VALID_FUTURE_DATE)

        self.assertTrue(result)