Exemple #1
0
def closed_stream(body):
    """Builds an in-memory stream whose entire request body is the given string.

    :param body:
        Request body for the returned Stream
    """
    stream = InMemStream(body)
    stream.close()
    return stream
Exemple #2
0
def closed_stream(body):
    """Builds an in-memory stream whose entire request body is the given string.

    :param body:
        Request body for the returned Stream
    """
    stream = InMemStream(body)
    stream.close()
    return stream
Exemple #3
0
def test_InMemStream():
    stream = InMemStream()
    yield stream.write("1")
    yield stream.write("2")
    buf = yield stream.read()
    assert buf == "12"

    yield stream.write("3")
    buf = yield stream.read()
    assert buf == "3"

    # check internal stream buffer.
    assert len(stream._stream) == 0

    stream.close()
    with pytest.raises(StreamingError):
        yield stream.write("4")
def stream(s):
    s = InMemStream(s)
    s.close()
    return s
Exemple #5
0
def closed_stream(body):
    stream = InMemStream(body)
    stream.close()
    return stream
Exemple #6
0
def stream(s):
    s = InMemStream(s)
    s.close()
    return s
def closed_stream(body):
    stream = InMemStream(body)
    stream.close()
    return stream