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.print_report_time_entries(report_data,
output_format, summary)
if summary:
Report.print_report_time_entries(summary_report,
output_format, summary)
# For summary do not print time entries.
# if summary:
# Report.print_report_time_entries(summary_report,
# output_format, summary)
def _init_date(self, start_date, end_date):

View file

@ -114,22 +114,22 @@ class ReportTestCase(ctt.test.CttTestCase):
output = self._get_output()
self.assertEqual(output, expected_output)
def test_print_reports_summary(self):
reports = collections.OrderedDict()
for project in ('foo1', 'foo2'):
rep = report.Report(project, ('2016-04-07',), ('2016-04-08',),
ctt.REPORTFORMAT, None, None)
report_data = rep.report()
reports[project] = (rep, report_data)
expected_output = (
"2016-04-07-0810 (0:00:10): foo2\n"
"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()
self.assertEqual(output, expected_output)
# Summary should not print time entries
# def test_print_reports_summary(self):
# reports = collections.OrderedDict()
# for project in ('foo1', 'foo2'):
# rep = report.Report(project, ('2016-04-07',), ('2016-04-08',),
# ctt.REPORTFORMAT, None, None)
# report_data = rep.report()
# reports[project] = (rep, report_data)
# expected_output = (
# "2016-04-07-0810 (0:00:10): foo2\n"
# "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()
# self.assertEqual(output, expected_output)
def test__init_date(self):
rep = report.Report('foo1', ('2016-04-07',), ('2016-04-07',),