'Test write points from df w/escaped tag in TestDataFrameClient.'

def test_write_points_from_dataframe_with_tag_escaped(self):

    now = pd.Timestamp(u'1970-01-01    00:00+00:00')
    dataframe = pd.DataFrame(data=[[u'blue    orange', u'1', 1, u'hot=cold'], [u'red,green', u'2', 2, u'cold\\fire'], [u'some', u'2', 2, u''], [u'some', u'2', 2, None], [u'', u'2', 2, None]], index=pd.period_range(now, freq=u'H', periods=5), columns=[u'tag_one', u'column_one', u'column_two', u'tag_three'])
    expected_escaped_tags = 'foo,tag_one=blue\\    orange,tag_three=hot\\=cold    column_one="1",column_two=1i    0\nfoo,tag_one=red\\,green,tag_three=cold\\\\fire    column_one="2",column_two=2i    3600000000000\nfoo,tag_one=some    column_one="2",column_two=2i    7200000000000\nfoo,tag_one=some    column_one="2",column_two=2i    10800000000000\nfoo    column_one="2",column_two=2i    14400000000000\n'
    with requests_mock.Mocker() as m:
        m.register_uri(requests_mock.POST, u'http://localhost:8086/write', status_code=204)
        cli = DataFrameClient(database=u'db')
        cli.write_points(dataframe, u'foo', field_columns=[u'column_one', u'column_two'], tag_columns=[u'tag_one', u'tag_three'])
        self.assertEqual(m.last_request.body, expected_escaped_tags)
