Add test for the milla.allow decorator

master
Dustin C. Hatch 2012-11-30 21:17:16 -06:00
parent 91f2d954e7
commit 47103b76a4
1 changed files with 9 additions and 0 deletions

View File

@ -394,3 +394,12 @@ def test_single_start_response():
assert start_response.call_count == 1, start_response.call_count assert start_response.call_count == 1, start_response.call_count
assert response.headers.startswith('HTTP/1.1 200 OK'), response.headers assert response.headers.startswith('HTTP/1.1 200 OK'), response.headers
assert response.body == 'test', response.body assert response.body == 'test', response.body
def test_allow_decorator():
'''Ensure allow decorator sets allowed_methods on controllers'''
@milla.allow('GET', 'HEAD', 'POST')
def controller(request):
return 'success'
assert controller.allowed_methods == ('GET', 'HEAD', 'POST')