
* Migrate additional test modules away from the deprecated framework, taking care to demonstrate both unittest- and pytest-style testing. * Add an additional Cookie class and parse cookies in the Result object to facilitate cookie testing. * Extend BoundStream to implement more of the IO protocol so that it works with mock WSGI input objects (and potentially improves compatibility as a drop-in replacement for the native WSGI input object). * Disable pypy3 testing on Travis, since it uses a buggy cookie impl, and also we don't support pypy3 (yet) since overall it isn't fully baked. * Specify latest pypy version for Travis testing, which has improved cookie handling.
18 lines
331 B
Python
18 lines
331 B
Python
import io
|
|
|
|
import pytest
|
|
|
|
from falcon.request_helpers import BoundedStream
|
|
|
|
|
|
@pytest.fixture
|
|
def bounded_stream():
|
|
return BoundedStream(io.BytesIO(), 1024)
|
|
|
|
|
|
def test_not_writeable(bounded_stream):
|
|
assert not bounded_stream.writeable()
|
|
|
|
with pytest.raises(IOError):
|
|
bounded_stream.write(b'something something')
|