'Test write points from dataframe with period index.'

def test_write_points_from_dataframe_with_period_index(self):

    dataframe = pd.DataFrame(data=[['1', 1, 1.0], ['2', 2, 2.0]], index=[pd.Period('1970-01-01'), pd.Period('1970-01-02')], columns=['column_one', 'column_two', 'column_three'])
    points = [{'points': [['1', 1, 1.0, 0], ['2', 2, 2.0, 86400]], 'name': 'foo', 'columns': ['column_one', 'column_two', 'column_three', 'time']}]
    with requests_mock.Mocker() as m:
        m.register_uri(requests_mock.POST, 'http://localhost:8086/db/db/series')
        cli = DataFrameClient(database='db')
        cli.write_points({'foo': dataframe})
        self.assertListEqual(json.loads(m.last_request.body), points)
