diff options
author | Marcel Hellkamp <marc@gsites.de> | 2016-09-24 12:34:03 +0200 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2016-09-24 12:34:03 +0200 |
commit | 7152755e124217c8b6d6633e30a27e368fb1d12b (patch) | |
tree | 4fd6af987de6eedafb95ccc6b32fcd0777ef500e | |
parent | 902f769619248d72f33ba88208f0765e4cecd273 (diff) | |
download | bottle-7152755e124217c8b6d6633e30a27e368fb1d12b.tar.gz |
Added tests for #892
-rw-r--r-- | test/test_plugins.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_plugins.py b/test/test_plugins.py index b9f613b..b756a22 100644 --- a/test/test_plugins.py +++ b/test/test_plugins.py @@ -2,6 +2,8 @@ import unittest import tools +from bottle import HTTPResponse, HTTPError + class MyPlugin(object): def __init__(self): @@ -150,6 +152,16 @@ class TestPluginManagement(tools.ServerTestBase): self.assertBody('plugin;global-1', '/a') self.assertBody('plugin', '/b') + def test_json_plugin_catches_httpresponse(self): + @self.app.get('/return') + def _(): + return HTTPResponse({'test': 'ko'}, 402) + @self.app.get('/raise') + def _(): + raise HTTPResponse({'test': 'ko2'}, 402) + + self.assertBody(b'{"test": "ko"}', '/return') + self.assertBody(b'{"test": "ko2"}', '/raise') class TestPluginAPI(tools.ServerTestBase): |