def test_getOutboundDates_normal(self): dates = search.getOutboundDates({'end_date': datetime.date.today()+datetime.timedelta(21), 'start_date': datetime.date.today()-datetime.timedelta(7), 'departdaysofweek': [1]}) self.assertEqual(len(dates), 3) for d in dates: self.assertEqual(d.isoweekday(), 1)
def test_getOutboundDates_multiple(self): dates = search.getOutboundDates({'end_date': datetime.date.today()+datetime.timedelta(21), 'start_date': datetime.date.today()-datetime.timedelta(7), 'departdaysofweek': [1, 3]}) self.assertEqual(len(dates), 6) for d in dates: self.assertTrue(d.isoweekday() in (1,3)) self.assertEqual(len([d for d in dates if d.isoweekday()==3]), 3)
def test_getOutboundDates_endInPast(self): self.assertEqual(search.getOutboundDates({'end_date':datetime.date.today()-datetime.timedelta(1)}), [])