diff --git a/tests/pecantest/test/controllers/ws.py b/tests/pecantest/test/controllers/ws.py index 410bbef..42b6b1f 100644 --- a/tests/pecantest/test/controllers/ws.py +++ b/tests/pecantest/test/controllers/ws.py @@ -49,6 +49,8 @@ class AuthorsController(RestController): @wsme.pecan.wsexpose(Author, int) def get(self, id): + if id == 999: + raise wsme.exc.ClientSideError('Wrong ID') author = Author() author.id = id author.firstname = u"aname" diff --git a/tests/pecantest/test/tests/test_ws.py b/tests/pecantest/test/tests/test_ws.py index 03457e9..01e0994 100644 --- a/tests/pecantest/test/tests/test_ws.py +++ b/tests/pecantest/test/tests/test_ws.py @@ -24,3 +24,14 @@ class TestWS(FunctionalTest): print a assert '1' in a.body assert 'aname' in a.body + + def test_clientsideerror(self): + res = self.app.get( + '/authors/999.json', + expect_errors=True + ) + print res + assert res.status == 400 + a = json.loads(res.body) + print a + assert a['faultcode'] == 'Client'