Test changing the default status_code in pecan

This commit is contained in:
Angus Salkeld 2013-04-30 15:26:06 +10:00
parent 6e5cb63d7a
commit 4c581aac48
2 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,7 @@ class AuthorsController(RestController):
]
return author
@wsmeext.pecan.wsexpose(Author, body=Author)
@wsmeext.pecan.wsexpose(Author, body=Author, status_code=201)
def post(self, author):
author.id = 10
return author

View File

@ -63,6 +63,7 @@ class TestWS(FunctionalTest):
'/authors', '{"firstname": "test"}',
headers={"Content-Type": "application/json"}
)
assert res.status_int == 201
a = json.loads(res.body)
print a
assert a['id'] == 10