diff --git a/tests/pecantest/test/controllers/ws.py b/tests/pecantest/test/controllers/ws.py index 8a3535e..d85ff55 100644 --- a/tests/pecantest/test/controllers/ws.py +++ b/tests/pecantest/test/controllers/ws.py @@ -80,3 +80,8 @@ class AuthorsController(RestController): ) ] return author + + @wsmeext.pecan.wsexpose(Author, body=Author) + def post(self, author): + author.id = 10 + return author diff --git a/tests/pecantest/test/tests/test_ws.py b/tests/pecantest/test/tests/test_ws.py index 3bb409d..621b672 100644 --- a/tests/pecantest/test/tests/test_ws.py +++ b/tests/pecantest/test/tests/test_ws.py @@ -57,6 +57,16 @@ class TestWS(FunctionalTest): assert '1' in a.body assert 'aname' 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',