def test_hook_tick_limit(self): broker = InfluxdbBroker(self.basic_modconf) broker.tick_limit = 300 broker.ticks = 299 broker.buffer.append('this_wont_work_lol') broker.hook_tick(None) broker.hook_tick(None) self.assertEqual(broker.ticks, 0) self.assertEqual(broker.buffer, [])
def test_hook_tick(self): setattr(self.basic_modconf, 'use_udp', '1') data = [ { "points": [["1", 1, 1.0], ["2", 2, 2.0]], "name": "foo", "columns": ["column_one", "column_two", "column_three"] } ] broker = InfluxdbBroker(self.basic_modconf) broker.init() broker.buffer.append(data) broker.ticks = 300 broker.hook_tick(None) # We are not testing python-influxdb. # We are only making sure that the format of points we are sending # does not raise errors and that the buffer empties. self.assertEqual(broker.buffer, []) self.assertEqual(broker.ticks, 0)