This commit is contained in:
Channel Cat 2017-01-29 23:21:00 -08:00 committed by Kyle Blöm
parent 078bf83aad
commit e5c6e0b6ce

View File

@ -233,24 +233,31 @@ def test_bp_shorthand():
app = Sanic('test_shorhand_routes') app = Sanic('test_shorhand_routes')
blueprint = Blueprint('test_shorhand_routes') blueprint = Blueprint('test_shorhand_routes')
@blueprint.get('/get')
def handler(request): def handler(request):
return text('OK') return text('OK')
@blueprint.put('/put')
def handler(request): def handler(request):
return text('OK') return text('OK')
@blueprint.post('/post')
def handler(request): def handler(request):
return text('OK') return text('OK')
@blueprint.head('/head')
def handler(request): def handler(request):
return text('OK') return text('OK')
@blueprint.options('/options')
def handler(request): def handler(request):
return text('OK') return text('OK')
@blueprint.patch('/patch')
def handler(request): def handler(request):
return text('OK') return text('OK')
@blueprint.delete('/delete')
def handler(request): def handler(request):
return text('OK') return text('OK')
@ -275,6 +282,7 @@ def test_bp_shorthand():
assert response.status == 405 assert response.status == 405
request, response = sanic_endpoint_test(app, uri='/head', method='head') request, response = sanic_endpoint_test(app, uri='/head', method='head')
assert response.status == 200
request, response = sanic_endpoint_test(app, uri='/head', method='get') request, response = sanic_endpoint_test(app, uri='/head', method='get')
assert response.status == 405 assert response.status == 405