test_sender.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:kinesis_producer 作者: ludia 项目源码 文件源码
def test_flush(config):
    q = queue.Queue()
    accumulator = RecordAccumulator(RawBuffer, config)
    client = mock.Mock()

    sender = Sender(queue=q, accumulator=accumulator,
                    client=client, partitioner=partitioner)

    sender.flush()
    assert not client.put_record.called

    accumulator.try_append(b'-')

    sender.flush()
    expected_record = (b'-\n', 4)
    client.put_record.assert_called_once_with(expected_record)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号