'Test that write_points called after the right number of events.'

def test_auto_commit(self):

    class AutoCommitTest(SeriesHelper, ):
        'Define    an    instance    of    SeriesHelper    for    AutoCommit    test.'
        class Meta:
            'Define    metadata    AutoCommitTest    object.'
            series_name = 'events.stats.{server_name}'
            fields = ['time', 'server_name']
            bulk_size = 5
            client = InfluxDBClient()
            autocommit = True
    fake_write_points = mock.MagicMock()
    AutoCommitTest(server_name='us.east-1', time=159)
    AutoCommitTest._client.write_points = fake_write_points
    AutoCommitTest(server_name='us.east-1', time=158)
    AutoCommitTest(server_name='us.east-1', time=157)
    AutoCommitTest(server_name='us.east-1', time=156)
    self.assertFalse(fake_write_points.called)
    AutoCommitTest(server_name='us.east-1', time=3443)
    self.assertTrue(fake_write_points.called)
