Pecan adapter is now at 100% of code coverage
This commit is contained in:
parent
98a89b808b
commit
bd184770a3
@ -1,6 +1,7 @@
|
|||||||
from pecan import expose
|
from pecan import expose
|
||||||
from webob.exc import status_map
|
from webob.exc import status_map
|
||||||
from .ws import AuthorsController
|
from .ws import AuthorsController
|
||||||
|
from wsme.pecan import wsexpose
|
||||||
|
|
||||||
|
|
||||||
class RootController(object):
|
class RootController(object):
|
||||||
@ -14,3 +15,7 @@ class RootController(object):
|
|||||||
status = 500
|
status = 500
|
||||||
message = getattr(status_map.get(status), 'explanation', '')
|
message = getattr(status_map.get(status), 'explanation', '')
|
||||||
return dict(status=status, message=message)
|
return dict(status=status, message=message)
|
||||||
|
|
||||||
|
@wsexpose()
|
||||||
|
def divide_by_zero(self):
|
||||||
|
1 / 0
|
||||||
|
@ -67,3 +67,18 @@ class TestWS(FunctionalTest):
|
|||||||
a = json.loads(res.body)
|
a = json.loads(res.body)
|
||||||
print a
|
print a
|
||||||
assert a['faultcode'] == 'Client'
|
assert a['faultcode'] == 'Client'
|
||||||
|
|
||||||
|
res = self.app.get(
|
||||||
|
'/authors/999.xml',
|
||||||
|
expect_errors=True
|
||||||
|
)
|
||||||
|
print res
|
||||||
|
self.assertEqual(res.status, '400 Bad Request')
|
||||||
|
assert '<faultcode>Client</faultcode>' in res.body
|
||||||
|
|
||||||
|
def test_serversideerror(self):
|
||||||
|
res = self.app.get('/divide_by_zero.json', expect_errors=True)
|
||||||
|
self.assertEqual(res.status, '500 Internal Server Error')
|
||||||
|
a = json.loads(res.body)
|
||||||
|
print a
|
||||||
|
assert a['faultcode'] == 'Server'
|
||||||
|
Loading…
Reference in New Issue
Block a user