Merge pull request #100 from chhsiao90/test-router
Add test for method not allow situation
This commit is contained in:
commit
12e900e8f9
|
@ -164,3 +164,17 @@ def test_route_duplicate():
|
|||
@app.route('/test/<dynamic>/')
|
||||
async def handler2(request, dynamic):
|
||||
pass
|
||||
|
||||
|
||||
def test_method_not_allowed():
|
||||
app = Sanic('test_method_not_allowed')
|
||||
|
||||
@app.route('/test', methods=['GET'])
|
||||
async def handler(request):
|
||||
return text('OK')
|
||||
|
||||
request, response = sanic_endpoint_test(app, uri='/test')
|
||||
assert response.status == 200
|
||||
|
||||
request, response = sanic_endpoint_test(app, method='post', uri='/test')
|
||||
assert response.status == 405
|
||||
|
|
Loading…
Reference in New Issue
Block a user