'Test write in TestInfluxDBClient object.'

def test_write(self):

    with requests_mock.Mocker() as m:
        m.register_uri(requests_mock.POST, u'http://localhost:8086/write', status_code=204)
        cli = InfluxDBClient(database=u'db')
        cli.write({u'database': u'mydb', u'retentionPolicy': u'mypolicy', u'points': [{u'measurement': u'cpu_load_short', u'tags': {u'host': u'server01', u'region': u'us-west'}, u'time': u'2009-11-10T23:00:00Z', u'fields': {u'value': 0.64}}]})
        self.assertEqual(m.last_request.body, 'cpu_load_short,host=server01,region=us-west    value=0.64    1257894000000000000\n')
