Beispiel #1
0
 def test_default_due_date_works_on_leap_year(self, mock_date_today):
     mock_date_today.return_value = datetime.date(2016, 2, 29)
     self.assertEqual(DueDate().date, datetime.date(2016, 3, 30))
Beispiel #2
0
 def test_due_date_can_be_set_to_a_valid_date(self):
     five_days_from_now = datetime.timedelta(days=5)
     delta = datetime.date.today() + five_days_from_now
     due_date = DueDate(date=delta)
     self.assertEqual(due_date.date, delta)
Beispiel #3
0
 def test_default_due_date_works_on_new_years_eve(self, mock_date_today):
     mock_date_today.return_value = datetime.date(2015, 12, 31)
     self.assertEqual(DueDate().date, datetime.date(2016, 01, 30))
Beispiel #4
0
 def test_due_date_can_be_provided_as_a_ddmmyyy_string(self):
     due_date = DueDate(date='2016-08-30')
     self.assertEqual(due_date.date, datetime.date(2016, 8, 30))
Beispiel #5
0
 def test_due_date_is_30_days_by_default(self):
     thirty_days_from_now = datetime.timedelta(days=30)
     delta = datetime.date.today() + thirty_days_from_now
     self.assertEqual(DueDate().date, delta)
Beispiel #6
0
 def test_returns_false_if_due_date_is_before_date(self):
     due_date = DueDate(date=datetime.date(2014, 1, 1))
     self.assertEqual(due_date.is_after(datetime.date(2015, 1, 1)), False)
 def test_human_readable_due_date_month_is_correct_for_april(self):
     due_date = DueDate(date=datetime.date(2015, 4, 4))
     self.assertEqual(due_date.human_readable_date, 'Apr 4')
 def test_human_readable_due_date_month_is_correct_for_november(self):
     due_date = DueDate(date=datetime.date(2015, 11, 11))
     self.assertEqual(due_date.human_readable_date, 'Nov 11')
 def test_human_readable_due_date_month_is_correct_for_december(self):
     due_date = DueDate(date=datetime.date(2015, 12, 24))
     self.assertEqual(due_date.human_readable_date, 'Des 24')
 def test_human_readable_due_date_month_is_correct_for_september(self):
     due_date = DueDate(date=datetime.date(2015, 9, 9))
     self.assertEqual(due_date.human_readable_date, 'Sep 9')
 def test_human_readable_due_date_month_is_correct_for_october(self):
     due_date = DueDate(date=datetime.date(2015, 10, 10))
     self.assertEqual(due_date.human_readable_date, 'Okt 10')
 def test_human_readable_due_date_month_is_correct_for_august(self):
     due_date = DueDate(date=datetime.date(2015, 8, 8))
     self.assertEqual(due_date.human_readable_date, 'Aug 8')
 def test_human_readable_due_date_month_is_correct_for_july(self):
     due_date = DueDate(date=datetime.date(2015, 7, 7))
     self.assertEqual(due_date.human_readable_date, 'Jul 7')
 def test_human_readable_due_date_month_is_correct_for_may(self):
     due_date = DueDate(date=datetime.date(2015, 5, 5))
     self.assertEqual(due_date.human_readable_date, 'Mai 5')
Beispiel #15
0
 def test_days_till_due_date_is_one_when_one_day_till_due_date(
         self, mock_date_today):
     mock_date_today.return_value = datetime.date(2016, 1, 1)
     due_date = DueDate(date=datetime.date(2016, 1, 2))
     self.assertEqual(due_date.remaining_days, 1)
 def test_human_readable_due_date_month_is_correct_for_january(self):
     due_date = DueDate(date=datetime.date(2015, 01, 1))
     self.assertEqual(due_date.human_readable_date, 'Jan 1')
Beispiel #17
0
 def test_days_till_due_date_is_0_when_due_date_is_in_the_past(
         self, mock_date_today):
     mock_date_today.return_value = datetime.date(2016, 1, 2)
     due_date = DueDate(date=datetime.date(2016, 1, 1))
     self.assertEqual(due_date.remaining_days, 0)
Beispiel #18
0
 def test_due_date_can_be_provided_as_an_empty_string(self):
     due_date = DueDate(date='')
Beispiel #19
0
 def test_returns_true_if_date_is_none(self):
     due_date = DueDate(date=datetime.date(2015, 01, 1))
     self.assertEqual(due_date.is_after(None), True)
 def test_human_readable_due_date_month_is_correct_for_february(self):
     due_date = DueDate(date=datetime.date(2015, 2, 2))
     self.assertEqual(due_date.human_readable_date, 'Feb 2')