Fix summary option output.

This commit is contained in:
Darko Poljak 2016-11-07 08:47:12 +01:00
parent 03fcffb3bf
commit 9adc35f78b
2 changed files with 32 additions and 31 deletions

View file

@ -117,9 +117,10 @@ class Report(object):
report.header() report.header()
Report.print_report_time_entries(report_data, Report.print_report_time_entries(report_data,
output_format, summary) output_format, summary)
if summary: # For summary do not print time entries.
Report.print_report_time_entries(summary_report, # if summary:
output_format, summary) # Report.print_report_time_entries(summary_report,
# output_format, summary)
def _init_date(self, start_date, end_date): def _init_date(self, start_date, end_date):

View file

@ -114,22 +114,22 @@ class ReportTestCase(ctt.test.CttTestCase):
output = self._get_output() output = self._get_output()
self.assertEqual(output, expected_output) self.assertEqual(output, expected_output)
def test_print_reports_summary(self): # Summary should not print time entries
reports = collections.OrderedDict() # def test_print_reports_summary(self):
for project in ('foo1', 'foo2'): # reports = collections.OrderedDict()
rep = report.Report(project, ('2016-04-07',), ('2016-04-08',), # for project in ('foo1', 'foo2'):
ctt.REPORTFORMAT, None, None) # rep = report.Report(project, ('2016-04-07',), ('2016-04-08',),
report_data = rep.report() # ctt.REPORTFORMAT, None, None)
reports[project] = (rep, report_data) # report_data = rep.report()
expected_output = ( # reports[project] = (rep, report_data)
"2016-04-07-0810 (0:00:10): foo2\n" # expected_output = (
"2016-04-07-0826 (0:00:06): foo1\n" # "2016-04-07-0810 (0:00:10): foo2\n"
"2016-04-08-1200 (1:23:20): foo1 12" # "2016-04-07-0826 (0:00:06): foo1\n"
) # "2016-04-08-1200 (1:23:20): foo1 12"
rep.print_reports(reports, ctt.REPORTFORMAT, summary=True) # )
output = self._get_output() # rep.print_reports(reports, ctt.REPORTFORMAT, summary=True)
self.assertEqual(output, expected_output) # output = self._get_output()
# self.assertEqual(output, expected_output)
def test__init_date(self): def test__init_date(self):
rep = report.Report('foo1', ('2016-04-07',), ('2016-04-07',), rep = report.Report('foo1', ('2016-04-07',), ('2016-04-07',),