def test_agenda_has_undone_tasks(self): """ Check that any undone tasks from today are carried over to tomorrow's agenda """ next_day = datetime.date(2012, 12, 10) (date, day, month, year) = ( next_day.day, next_day.strftime('%A'), next_day.strftime('%B'), next_day.year, ) tasklist = FilesystemTasklist() tasklist.file = StringIO(self.tasklist) daythemesfile = StringIO(self.daythemes) dayfile = StringIO(self.daytemplate_undone) checkpointsfile = StringIO(self.checkpoints_weekday) periodicfile = StringIO(self.periodic_day) checkpointsfile = StringIO(self.checkpoints_weekday) planner = FilesystemPlanner() planner.tasklist = tasklist planner.daythemesfile = daythemesfile planner.checkpoints_weekday_file = checkpointsfile planner.periodic_day_file = periodicfile planner.dayfile = dayfile planner.next_day_planner = FilesystemPlanner() dailythemes = self.daythemes.lower() theme = dailythemes[dailythemes.index(day.lower()):] theme = theme[theme.index(':'):].strip(': ') theme = theme[:theme.index('\n')].strip().upper() theme = "*" + theme + "*" daytemplate = "" daytemplate += "= %s %s %d, %d =\n" % ( day.upper(), month[:3].upper(), date, year, ) daytemplate += "\n" if len(theme) > 2: daytemplate += "Theme: %s\n" % theme daytemplate += "\n" daytemplate += "CHECKPOINTS:\n" daytemplate += self.checkpoints_weekday daytemplate += "\n" daytemplate += "AGENDA:\n" daytemplate += "[ ] s'posed to do\n" daytemplate += "[\\] kinda did\n" daytemplate += "\n" daytemplate += "DAILYs:\n" daytemplate += self.periodic_day daytemplate += "\n" daytemplate += "NOTES:\n\n\n" daytemplate += "TIME SPENT ON PLANNER: " planner.create_log(Day, next_day) self.assertEqual(planner.next_day_planner.dayfile.read(), daytemplate)
def test_agenda_is_empty_when_tomorrow_and_undone_are_empty(self): """ Check that tomorrow's agenda is empty when no tasks are undone from today, and no tasks have been added for tomorrow """ next_day = datetime.date(2012, 12, 10) (date, day, month, year) = ( next_day.day, next_day.strftime('%A'), next_day.strftime('%B'), next_day.year, ) tasklist = FilesystemTasklist() tasklist.file = StringIO(self.tasklist) daythemesfile = StringIO(self.daythemes) dayfile = StringIO(self.daytemplate) checkpointsfile = StringIO(self.checkpoints_weekday) periodicfile = StringIO(self.periodic_day) checkpointsfile = StringIO(self.checkpoints_weekday) planner = FilesystemPlanner() planner.tasklist = tasklist planner.daythemesfile = daythemesfile planner.checkpoints_weekday_file = checkpointsfile planner.periodic_day_file = periodicfile planner.dayfile = dayfile planner.next_day_planner = FilesystemPlanner() dailythemes = self.daythemes.lower() theme = dailythemes[dailythemes.index(day.lower()):] theme = theme[theme.index(':'):].strip(': ') theme = theme[:theme.index('\n')].strip().upper() theme = "*" + theme + "*" daytemplate = "" daytemplate += "= %s %s %d, %d =\n" % ( day.upper(), month[:3].upper(), date, year, ) daytemplate += "\n" if len(theme) > 2: daytemplate += "Theme: %s\n" % theme daytemplate += "\n" daytemplate += "CHECKPOINTS:\n" daytemplate += self.checkpoints_weekday daytemplate += "\n" daytemplate += "AGENDA:\n" daytemplate += "\n" daytemplate += "DAILYs:\n" daytemplate += self.periodic_day daytemplate += "\n" daytemplate += "NOTES:\n\n\n" daytemplate += "TIME SPENT ON PLANNER: " planner.create_log(Day, next_day) self.assertEqual(planner.next_day_planner.dayfile.read(), daytemplate)
def test_agenda_does_not_have_scheduled_tasks(self): """Check that if a scheduled task on the current day's agenda is technically due tomorrow, it isn't carried over by the logfile creation process since it should happen indirectly via tasklist advance which would place the task in the tomorrow section if applicable. """ # TODO: note this test is almost identical to the undone one, with just # a different date -- obviously, these tests need to be refactored at # some point next_day = datetime.date(2012, 12, 25) (date, day, month, year) = ( next_day.day, next_day.strftime('%A'), next_day.strftime('%B'), next_day.year, ) tasklist = FilesystemTasklist() tasklist.file = StringIO(self.tasklist) daythemesfile = StringIO(self.daythemes) dayfile = StringIO(self.daytemplate_undone) checkpointsfile = StringIO(self.checkpoints_weekday) periodicfile = StringIO(self.periodic_day) checkpointsfile = StringIO(self.checkpoints_weekday) planner = FilesystemPlanner() planner.tasklist = tasklist planner.daythemesfile = daythemesfile planner.checkpoints_weekday_file = checkpointsfile planner.periodic_day_file = periodicfile planner.dayfile = dayfile planner.next_day_planner = FilesystemPlanner() dailythemes = self.daythemes.lower() theme = dailythemes[dailythemes.index(day.lower()):] theme = theme[theme.index(':'):].strip(': ') theme = theme[:theme.index('\n')].strip().upper() theme = "*" + theme + "*" daytemplate = "" daytemplate += "= %s %s %d, %d =\n" % ( day.upper(), month[:3].upper(), date, year, ) daytemplate += "\n" if len(theme) > 2: daytemplate += "Theme: %s\n" % theme daytemplate += "\n" daytemplate += "CHECKPOINTS:\n" daytemplate += self.checkpoints_weekday daytemplate += "\n" daytemplate += "AGENDA:\n" daytemplate += "[ ] s'posed to do\n" daytemplate += "[\\] kinda did\n" daytemplate += "\n" daytemplate += "DAILYs:\n" daytemplate += self.periodic_day daytemplate += "\n" daytemplate += "NOTES:\n\n\n" daytemplate += "TIME SPENT ON PLANNER: " planner.create_log(Day, next_day) self.assertEqual(planner.next_day_planner.dayfile.read(), daytemplate)
def test_agenda_has_both_tomorrows_tasks_and_undone_tasks(self): """ Check that tomorrow's agenda has both undone tasks from today's agenda as well as tasks added for tomorrow """ next_day = datetime.date(2012, 12, 10) (date, day, month, year) = ( next_day.day, next_day.strftime('%A'), next_day.strftime('%B'), next_day.year, ) tasklist = FilesystemTasklist() tasklist.file = StringIO(self.tasklist_tomorrow) daythemesfile = StringIO(self.daythemes) dayfile = StringIO(self.daytemplate_undone) checkpointsfile = StringIO(self.checkpoints_weekday) periodicfile = StringIO(self.periodic_day) checkpointsfile = StringIO(self.checkpoints_weekday) planner = FilesystemPlanner() planner.tasklist = tasklist planner.daythemesfile = daythemesfile planner.checkpoints_weekday_file = checkpointsfile planner.periodic_day_file = periodicfile planner.dayfile = dayfile planner.next_day_planner = FilesystemPlanner() dailythemes = self.daythemes.lower() theme = dailythemes[dailythemes.index(day.lower()):] theme = theme[theme.index(':'):].strip(': ') theme = theme[:theme.index('\n')].strip().upper() theme = "*" + theme + "*" daytemplate = "" daytemplate += "= %s %s %d, %d =\n" % ( day.upper(), month[:3].upper(), date, year, ) daytemplate += "\n" if len(theme) > 2: daytemplate += "Theme: %s\n" % theme daytemplate += "\n" daytemplate += "CHECKPOINTS:\n" daytemplate += self.checkpoints_weekday daytemplate += "\n" daytemplate += "AGENDA:\n" daytemplate += "[ ] contact dude\n" daytemplate += "[\\] make X\n" daytemplate += "[o] call somebody [$DECEMBER 12, 2012$]\n" daytemplate += "[o] apply for something [DECEMBER 26, 2012]\n" daytemplate += "[ ] finish project\n" daytemplate += "[ ] s'posed to do\n" daytemplate += "[\\] kinda did\n" daytemplate += "\n" daytemplate += "DAILYs:\n" daytemplate += self.periodic_day daytemplate += "\n" daytemplate += "NOTES:\n\n\n" daytemplate += "TIME SPENT ON PLANNER: " planner.create_log(Day, next_day) self.assertEqual(planner.next_day_planner.dayfile.read(), daytemplate)