def test_get_original_resend_option():
    def callback(_, __):
        """
        empty callback func
        :param _:
        :param __:
        :return:
        """
        print('done')

    sub = Subscription(stream_id, stream_partition, 'api_key', callback,
                       Option(resend_all=True))

    assert sub.get_effective_resend_option().resend_all is True
def test_get_resend_option_after_received_data3():
    def callback(_, __):
        """
        empty callback func
        :param _:
        :param __:
        :return:
        """
        print('done')

    sub = Subscription(stream_id, stream_partition, 'api_key', callback,
                       Option(resend_from_time=time.time()))
    sub.handle_message(create_msg(10))
    dic = sub.get_effective_resend_option()
    assert dic.resend_from == 11
def test_get_resend_option_after_received_data4():
    msg = create_msg()

    def callback(_, __):
        """
        empty callback func
        :param _:
        :param __:
        :return:
        """
        print('done')

    sub = Subscription(stream_id, stream_partition, 'api_key', callback,
                       Option(resend_last=10))
    sub.handle_message(msg)
    dic = sub.get_effective_resend_option()
    assert dic.resend_last == 10