Skip to content
Snippets Groups Projects
Commit 0659b5e0 authored by Jan Mach's avatar Jan Mach
Browse files

Fix: Fixed minor bugs after previous commits.

Few of the unit tests were failing after previous changes. (Redmine issue: #3443)
parent 44db90e4
No related branches found
No related tags found
No related merge requests found
......@@ -462,12 +462,14 @@ class TestMentatDatatypeSqldb(unittest.TestCase):
dt_from = dt_from,
dt_to = dt_to,
evcount_all = 1,
evcount_flt = 2,
evcount_flt_blk = 3,
evcount_thr = 4,
evcount_thr_blk = 5,
evcount_rlp = 6,
evcount_rep = 1,
evcount_all = 2,
evcount_new = 3,
evcount_flt = 4,
evcount_flt_blk = 5,
evcount_thr = 6,
evcount_thr_blk = 7,
evcount_rlp = 8,
mail_to = ['abuse@cesnet.cz'],
mail_dt = dt_from,
......
......@@ -414,7 +414,7 @@ class TestMentatReportsEvent(unittest.TestCase):
def test_11_render_report_extra(self):
"""
Test :py:class:`mentat.reports.event.EventReporter.render_report_summary` function.
Test :py:class:`mentat.reports.event.EventReporter.render_report_extra` function.
"""
self.maxDiff = None
......@@ -469,6 +469,7 @@ class TestMentatReportsEvent(unittest.TestCase):
dt_from = datetime.datetime.utcnow() - datetime.timedelta(seconds=3600),
dt_to = datetime.datetime.utcnow(),
evcount_rep = len(events),
evcount_all = len(events),
evcount_flt = len(events),
evcount_flt_blk = 1,
......@@ -482,6 +483,28 @@ class TestMentatReportsEvent(unittest.TestCase):
report.generate_handle()
report.calculate_delta()
if rtype == mentat.const.REPORTING_MODE_EXTRA:
report.parent = EventReportModel(
group = abuse_group,
severity = severity,
type = mentat.const.REPORTING_MODE_SUMMARY,
dt_from = datetime.datetime.utcnow() - datetime.timedelta(seconds=3600),
dt_to = datetime.datetime.utcnow(),
evcount_rep = len(events),
evcount_all = len(events),
evcount_flt = len(events),
evcount_flt_blk = 1,
evcount_thr = len(events),
evcount_thr_blk = 0,
evcount_rlp = 0,
filtering = {'FLT01':1}
)
report.parent.generate_label()
report.parent.generate_handle()
report.parent.calculate_delta()
report.statistics = mentat.stats.idea.truncate_evaluations(
mentat.stats.idea.evaluate_events(events)
)
......
......@@ -303,7 +303,7 @@ def aggregate_stats(stats, interval, dt_from, result = None):
result = _counter_inc(result, key, subkey, subval)
# Calculate secondary statistics (cnt, min, max, sum, avg).
stats = calculate_secondary_stats(stats)
result = calculate_secondary_stats(result)
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment