'Test writing points in a batch.'

def test_write_points_batch(self):

    dummy_points = [{u'measurement': u'cpu_usage', u'tags': {u'unit': u'percent'}, u'time': u'2009-11-10T23:00:00Z', u'fields': {u'value': 12.34}}, {u'measurement': u'network', u'tags': {u'direction': u'in'}, u'time': u'2009-11-10T23:00:00Z', u'fields': {u'value': 123.0}}, {u'measurement': u'network', u'tags': {u'direction': u'out'}, u'time': u'2009-11-10T23:00:00Z', u'fields': {u'value': 12.0}}]
    self.cli.write_points(points=dummy_points, tags={u'host': u'server01', u'region': u'us-west'}, batch_size=2)
    time.sleep(5)
    net_in = self.cli.query(u"SELECT    value    FROM    network    WHERE    direction='in'").raw
    net_out = self.cli.query(u"SELECT    value    FROM    network    WHERE    direction='out'").raw
    cpu = self.cli.query(u'SELECT    value    FROM    cpu_usage').raw
    self.assertIn(123, net_in[u'series'][0][u'values'][0])
    self.assertIn(12, net_out[u'series'][0][u'values'][0])
    self.assertIn(12.34, cpu[u'series'][0][u'values'][0])
