Add a test to reproduce the bug reported by Endre Karlson

This commit is contained in:
Christophe de Vienne 2013-02-15 14:33:25 +01:00
parent 9ee2d2f9a2
commit d71b762ae3
2 changed files with 15 additions and 0 deletions

View File

@ -80,3 +80,8 @@ class AuthorsController(RestController):
)
]
return author
@wsmeext.pecan.wsexpose(Author, body=Author)
def post(self, author):
author.id = 10
return author

View File

@ -57,6 +57,16 @@ class TestWS(FunctionalTest):
assert '<id>1</id>' in a.body
assert '<firstname>aname</firstname>' in a.body
def test_post_body_parameter(self):
res = self.app.post(
'/authors', '{"firstname": "test"}',
headers={"Content-Type": "application/json"}
)
a = json.loads(res.body)
print a
assert a['id'] == 10
assert a['firstname'] == 'test'
def test_clientsideerror(self):
res = self.app.get(
'/authors/999.json',