Add test for uri_template

This commit is contained in:
38elements 2017-04-30 19:01:17 +09:00
parent 6dc6f9bbb5
commit ab8f616385

View File

@ -133,6 +133,17 @@ def test_query_string():
assert request.args.get('test2') == 'false' assert request.args.get('test2') == 'false'
def test_uri_template():
app = Sanic('test_uri_template')
@app.route('/foo/<id:int>/bar/<name:[A-z]+>')
async def handler(request):
return text('OK')
request, response = app.test_client.get('/foo/123/bar/baz')
assert request.uri_template == '/foo/<id:int>/bar/<name:[A-z]+>'
def test_token(): def test_token():
app = Sanic('test_post_token') app = Sanic('test_post_token')