def test_today(self): calendar = datetime.utcnow().isocalendar() week = calendar[1] year = calendar[0] week_begin, week_end = week_begin_end_dates(week, year) values = get_week_data(self.account, week, year) from_date = datetime(hour=0, minute=0, day=week_begin.day, year=week_begin.year, month=week_begin.month).replace(tzinfo=self.account.tz) to_date = datetime(hour=23, minute=59, day=week_end.day, year=week_end.year, month=week_end.month).replace( tzinfo=self.account.tz) previous_date_url = "/week/" + str(week - 1) + "/2011" assert from_date == values['from_date'] assert to_date == values['to_date'] assert from_date == values['target_day'] assert from_date == values['display_date'] assert values['previous_date_url'] == previous_date_url assert values['next_date_url'] is None
def test_last_sunday_2011(self): """ The last Sunday of 2011 is 1/1/2012.""" beginning, end = week_begin_end_dates(52, 2011) assert(end == date(2012, 1, 1))
def test_last_monday_2011(self): """ The last monday of 2011 is 12/26/2011.""" beginning, end = week_begin_end_dates(52, 2011) assert(beginning == date(2011, 12, 26))
def test_first_sunday_2011(self): """ The first Sunday of 2011 is 1/9/2011.""" beginning, end = week_begin_end_dates(1, 2011) assert(end == date(2011, 1, 9))
def test_first_monday_2011(self): """ The first Monday of 2011 is 1/3/2011.""" beginning, end = week_begin_end_dates(1, 2011) assert(beginning == date(2011, 1, 3))
def test_week_ends_on_sunday(self): """ Week end dates should be a sunday.""" beginning, end = week_begin_end_dates(1, 2011) assert(end.weekday() == 6)
def test_week_begins_on_monday(self): """ Weeks begin dates should be a monday.""" beginning, end = week_begin_end_dates(1, 2011) assert(beginning.weekday() == 0)