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

def test_write_points_from_dataframe_with_tag_columns(self):

    now = pd.Timestamp(u'1970-01-01    00:00+00:00')
    dataframe = pd.DataFrame(data=[[u'blue', 1, u'1', 1, 1.0], [u'red', 0, u'2', 2, 2.0]], index=[now, (now + timedelta(hours=1))], columns=[u'tag_one', u'tag_two', u'column_one', u'column_two', u'column_three'])
    expected = 'foo,tag_one=blue,tag_two=1    column_one="1",column_two=1i,column_three=1.0    0\nfoo,tag_one=red,tag_two=0    column_one="2",column_two=2i,column_three=2.0    3600000000000\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', tag_columns=[u'tag_one', u'tag_two'])
        self.assertEqual(m.last_request.body, expected)
        cli.write_points(dataframe, u'foo', tag_columns=[u'tag_one', u'tag_two'], tags=None)
        self.assertEqual(m.last_request.body, expected)
