Skip to content

Commit

Permalink
Add explicit test for path
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 31, 2018
1 parent 06ed15e commit fdd9aab
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_web_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,3 +1640,23 @@ def handler(request):

resp = yield from client.get('/')
assert 200 == resp.status


@asyncio.coroutine
def test_request_path(loop, test_client):

@asyncio.coroutine
def handler(request):
assert request.path_qs == '/path%20to?a=1'
assert request.path == '/path to'
assert request.raw_path == '/path%20to?a=1'
return web.Response(body=b'OK')

app = web.Application()
app.router.add_get('/path to', handler)
client = yield from test_client(app)

resp = yield from client.get('/path to', params={'a': '1'})
assert 200 == resp.status
txt = yield from resp.text()
assert 'OK' == txt

0 comments on commit fdd9aab

Please sign in to comment.