def test_addActivity(self):
    activityRepo = ActivitiesRepository()
    cont = ActivitiesController(activityRepo, PersonsActivitiesRepo(), UndoRedoController())

    cont.addActivity(datetime(2014, 11, 21, 12, 30), "test1")

    self.assertIn(cont.findActivityById(1), cont.getActivitiesList())
  def test_findActivityById(self):
    activityRepo = ActivitiesRepository()
    cont = ActivitiesController(activityRepo, PersonsActivitiesRepo(), UndoRedoController())

    cont.addActivity(datetime(2014, 11, 21, 12, 30), "test1")

    self.assertEqual(cont.findActivityById(1), activityRepo.findById(1))
  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")])
  def test_getActivitiesList(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.getActivitiesList(), activityRepo.getAll())
  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_removeActivity(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")

    ac = cont.findActivityById(2)
    cont.removeActivity(2)

    self.assertNotIn(ac, cont.getActivitiesList())