Test changing the default status_code in pecan
This commit is contained in:
parent
6e5cb63d7a
commit
4c581aac48
@ -85,7 +85,7 @@ class AuthorsController(RestController):
|
|||||||
]
|
]
|
||||||
return author
|
return author
|
||||||
|
|
||||||
@wsmeext.pecan.wsexpose(Author, body=Author)
|
@wsmeext.pecan.wsexpose(Author, body=Author, status_code=201)
|
||||||
def post(self, author):
|
def post(self, author):
|
||||||
author.id = 10
|
author.id = 10
|
||||||
return author
|
return author
|
||||||
|
@ -63,6 +63,7 @@ class TestWS(FunctionalTest):
|
|||||||
'/authors', '{"firstname": "test"}',
|
'/authors', '{"firstname": "test"}',
|
||||||
headers={"Content-Type": "application/json"}
|
headers={"Content-Type": "application/json"}
|
||||||
)
|
)
|
||||||
|
assert res.status_int == 201
|
||||||
a = json.loads(res.body)
|
a = json.loads(res.body)
|
||||||
print a
|
print a
|
||||||
assert a['id'] == 10
|
assert a['id'] == 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user