'Test write_points called after valid number of events.'

def test_auto_commit(self):

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