def test_initialize_sums_without_groupby(self):
     sums_conf = [{'column': 'bytes_sent',
                   'period':  1,}]
     expected = [{'column_name' : 'bytes_sent',
                  'interval_duration_sec' : 60,
                  'current' : {'interval_started_at' : 0,
                               'value' : 0},
                  'previous' : []}]
     result = LogUtils.initialize_sums(sums_conf)
     self.assertEqual(expected, result)
 def test_initialize_sum_with_groupby(self):
     sums_conf = [{'column': 'bytes_sent',
                   'period': 1,
                   'groupby' : {'column': 'host',
                                'match': '(.*)'}}]
     expected = [{'column_name' : 'bytes_sent',
                  'interval_duration_sec': 60,
                  'groupby' : {'column' : 'host',
                               'match': '(.*)'},
                  'groups': {}}]
     result = LogUtils.initialize_sums(sums_conf)
     self.assertEqual(expected, result)
 def test_initialize_sums_without_groupby(self):
     sums_conf = [{
         'column': 'bytes_sent',
         'period': 1,
     }]
     expected = [{
         'column_name': 'bytes_sent',
         'interval_duration_sec': 60,
         'current': {
             'interval_started_at': 0,
             'value': 0
         },
         'previous': []
     }]
     result = LogUtils.initialize_sums(sums_conf)
     self.assertEqual(expected, result)
 def test_initialize_sum_with_groupby(self):
     sums_conf = [{
         'column': 'bytes_sent',
         'period': 1,
         'groupby': {
             'column': 'host',
             'match': '(.*)'
         }
     }]
     expected = [{
         'column_name': 'bytes_sent',
         'interval_duration_sec': 60,
         'groupby': {
             'column': 'host',
             'match': '(.*)'
         },
         'groups': {}
     }]
     result = LogUtils.initialize_sums(sums_conf)
     self.assertEqual(expected, result)