def test_get_summary_per_project_limit2(self): # Tests that hours are reported when from_date is equal to from_date of # a projectassoc period. report = TimeLog.get_summary_per_project(self.user1, '2010-09-16', '2010-09-18', True) expected = [ (self.ext_src, u'Fake Project 10', True, Decimal('13.500'), Decimal('0.19')) ] self.assertEqual(expected, list(report))
def test_get_summary_per_project_limit4(self): # Tests that hours are reported when to_date is equal to to_date of # a projectassoc period. report = TimeLog.get_summary_per_project(self.user1, '2010-09-28', '2010-09-30', True) expected = [ (self.ext_src, u'Fake Project 10', True, Decimal('17.000'), Decimal('0.19')), (self.ext_src, u'Fake Project 42', True, Decimal('5.000'), Decimal('0.00')) ] self.assertEqual(expected, list(report))
def test_get_summary_per_project_all_hours2(self): # Same as previous test, plus tests all works fine with a projassoc # with to_date not set. report = TimeLog.get_summary_per_project(self.user2, '2008-01-01', '2012-05-10', True) expected = [ (self.ext_src, u'Fake Project 10', True, Decimal('97.500'), Decimal('0.19')), (self.ext_src, u'Fake Project 42', True, Decimal('60.000'), Decimal('0.14')), (self.ext_src, u'Fake Project 42', True, Decimal('157.500'), Decimal('0.19')) ] self.assertEqual(expected, list(report))
def test_get_summary_per_project_all_hours1(self): # Tests that ALL hours are reported, including those with rate 0, that # is, hours logged within a projectassoc period with rate 0, and hours # logged in days not contained by any projectassoc period. report = TimeLog.get_summary_per_project(self.user1, '2008-01-01', '2012-05-10', True) expected = [ (self.ext_src, u'Fake Project 10', True, Decimal('71.000'), Decimal('0.19')), (self.ext_src, u'Fake Project 42', True, Decimal('60.000'), Decimal('0.00')), (self.ext_src, u'Fake Project 42', True, Decimal('360.000'), Decimal('0.50')) ] self.assertEqual(expected, list(report))