def test_project_timeline(self): res = project_timeline(self.project) self.assertEqual(res['periods'], self.dates) self.assertEqual( res['groups'], { self.user: { obj.timecard.reporting_period.start_date: obj.hours_spent for obj in self.objs } }, )
def test_project_timeline_no_limit(self): res = project_timeline(self.project, period_limit=None) self.assertEqual(res['periods'], self.dates) self.assertEqual(len(list(res['groups'].values())[0]), len(self.objs))
def test_project_timeline_diff_limit(self): limit = 8 res = project_timeline(self.project, period_limit=limit) self.assertEqual(res['periods'], self.dates[-limit:]) self.assertEqual(len(list(res['groups'].values())[0]), limit)