Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
hubo1016 committed Mar 23, 2017
1 parent 1438fc3 commit e65091c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,28 @@ def test_make_too_big_request_adjust_limit(loop):
assert len(txt) == 1024**2 + 1


@asyncio.coroutine
def test_multipart_formdata(loop):
payload = StreamReader(loop=loop)
payload.feed_data(b"""-----------------------------326931944431359\r
Content-Disposition: form-data; name="a"\r
\r
b\r
-----------------------------326931944431359\r
Content-Disposition: form-data; name="c"\r
\r
d\r
-----------------------------326931944431359--\r\n""")
content_type = "multipart/form-data; boundary="\
"---------------------------326931944431359"
payload.feed_eof()
req = make_mocked_request('POST', '/',
headers={'CONTENT-TYPE': content_type},
payload=payload)
result = yield from req.post()
assert dict(result) == {'a': 'b', 'c': 'd'}


@asyncio.coroutine
def test_make_too_big_request_limit_None(loop):
payload = StreamReader(loop=loop)
Expand Down

0 comments on commit e65091c

Please sign in to comment.