def test_getActivitiesBetweenDates(self): activityRepo = ActivitiesRepository() cont = ActivitiesController(activityRepo, PersonsActivitiesRepo(), UndoRedoController()) cont.addActivity(datetime(2014, 11, 21, 12, 30), "test1") cont.addActivity(datetime(1999, 9, 15, 19, 25), "test2") cont.addActivity(datetime(2015, 1, 31, 2, 10), "test3") self.assertEqual(cont.getActivitiesBetweenDates(date(2012, 1, 31), date(2017, 1, 31)), [Activity(1, datetime(2014, 11, 21, 12, 30), "test1"), Activity(3, datetime(2015, 1, 31, 2, 10), "test3")])
def test_findByDate(self): activityRepo = ActivitiesRepository() activityRepo.add(Activity(1, datetime(2014, 11, 21, 12, 30), "test1")) activityRepo.add(Activity(2, datetime(1999, 9, 15, 19, 25), "test2")) activityRepo.add(Activity(3, datetime(2015, 1, 31, 2, 10), "test3")) activityRepo.add(Activity(4, datetime(2015, 1, 31, 12, 36), "test4")) self.assertEqual(activityRepo.findByDate(date(2015, 1, 31)), [Activity(3, datetime(2015, 1, 31, 2, 10), "test3"), Activity(4, datetime(2015, 1, 31, 12, 36), "test4")])
def test_findActivityByDate(self): activityRepo = ActivitiesRepository() cont = ActivitiesController(activityRepo, PersonsActivitiesRepo(), UndoRedoController()) cont.addActivity(datetime(2014, 11, 21, 12, 30), "test1") cont.addActivity(datetime(1999, 9, 15, 19, 25), "test2") cont.addActivity(datetime(2015, 1, 31, 2, 10), "test3") cont.addActivity(datetime(2015, 1, 31, 12, 36), "test4") self.assertEqual(cont.findActivityByDate(date(2015, 1, 31)), [Activity(3, datetime(2015, 1, 31, 2, 10), "test3"), Activity(4, datetime(2015, 1, 31, 12, 36), "test4")])