diff options
Diffstat (limited to 'pecan/tests/test_hooks.py')
-rw-r--r-- | pecan/tests/test_hooks.py | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/pecan/tests/test_hooks.py b/pecan/tests/test_hooks.py index 66947ca..9c3192e 100644 --- a/pecan/tests/test_hooks.py +++ b/pecan/tests/test_hooks.py @@ -1017,21 +1017,6 @@ class TestTransactionHook(PecanTestCase): class TestRequestViewerHook(PecanTestCase): - def test_hook_from_config(self): - from pecan.configuration import _runtime_conf as conf - conf['requestviewer'] = { - 'blacklist': ['/favicon.ico'] - } - - class RootController(object): - pass - - app = make_app(RootController()) - while hasattr(app, 'application'): - app = app.application - del conf.__values__['requestviewer'] - assert app.hooks - def test_basic_single_default_hook(self): _stdout = StringIO() @@ -1043,7 +1028,9 @@ class TestRequestViewerHook(PecanTestCase): app = TestApp( make_app( - RootController(), hooks=[RequestViewerHook(writer=_stdout)] + RootController(), hooks=lambda: [ + RequestViewerHook(writer=_stdout) + ] ) ) response = app.get('/') @@ -1074,7 +1061,9 @@ class TestRequestViewerHook(PecanTestCase): app = TestApp( make_app( - RootController(), hooks=[RequestViewerHook(writer=_stdout)] + RootController(), hooks=lambda: [ + RequestViewerHook(writer=_stdout) + ] ) ) response = app.get('/404', expect_errors=True) @@ -1104,7 +1093,7 @@ class TestRequestViewerHook(PecanTestCase): app = TestApp( make_app( RootController(), - hooks=[ + hooks=lambda: [ RequestViewerHook( config={'items': ['path']}, writer=_stdout ) @@ -1139,7 +1128,7 @@ class TestRequestViewerHook(PecanTestCase): app = TestApp( make_app( RootController(), - hooks=[ + hooks=lambda: [ RequestViewerHook( config={'blacklist': ['/']}, writer=_stdout ) @@ -1166,7 +1155,7 @@ class TestRequestViewerHook(PecanTestCase): app = TestApp( make_app( RootController(), - hooks=[ + hooks=lambda: [ RequestViewerHook( config={'items': ['date']}, writer=_stdout ) |