diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-09-30 03:27:28 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-09-30 03:27:28 +0000 |
| commit | d75fe70228c89e3606e51a4d5775faf549252a90 (patch) | |
| tree | 043a7334d49a7455b80789f1aab56e4238dbd6b0 /repoze/bfg/tests | |
| parent | 4be6ce73f41e09bf0f3e5df01d7f5aaf4f3137a6 (diff) | |
| download | pyramid-d75fe70228c89e3606e51a4d5775faf549252a90.tar.gz pyramid-d75fe70228c89e3606e51a4d5775faf549252a90.tar.bz2 pyramid-d75fe70228c89e3606e51a4d5775faf549252a90.zip | |
- The import of ``repoze.bfg.view.NotFound`` is deprecated in favor of
``repoze.bfg.exceptions.NotFound``. The old location still
functions, but emits a deprecation warning.
- The import of ``repoze.bfg.security.Unauthorized`` is deprecated in
favor of ``repoze.bfg.exceptions.Forbidden``. The old location
still functions but emits a deprecation warning. The rename from
``Unauthorized`` to ``Forbidden`` brings parity to the the name of
the exception and the system view it invokes when raised.
- New ``repoze.bfg.exceptions`` module was created to house exceptions
that were previously sprinkled through various modules.
- An ``exceptions`` API chapter was added, documenting the new
``repoze.bfg.exceptions`` module.
Diffstat (limited to 'repoze/bfg/tests')
| -rw-r--r-- | repoze/bfg/tests/test_router.py | 6 | ||||
| -rw-r--r-- | repoze/bfg/tests/test_testing.py | 4 | ||||
| -rw-r--r-- | repoze/bfg/tests/test_view.py | 18 | ||||
| -rw-r--r-- | repoze/bfg/tests/test_zcml.py | 8 |
4 files changed, 18 insertions, 18 deletions
diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py index 3116d2572..5c39b65f0 100644 --- a/repoze/bfg/tests/test_router.py +++ b/repoze/bfg/tests/test_router.py @@ -672,10 +672,10 @@ class DummyView: def __call__(self, context, request): if self.raise_unauthorized: - from repoze.bfg.security import Unauthorized - raise Unauthorized('unauthorized') + from repoze.bfg.exceptions import Forbidden + raise Forbidden('unauthorized') if self.raise_notfound: - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound raise NotFound('notfound') return self.response diff --git a/repoze/bfg/tests/test_testing.py b/repoze/bfg/tests/test_testing.py index c302bd9f5..938115ecd 100644 --- a/repoze/bfg/tests/test_testing.py +++ b/repoze/bfg/tests/test_testing.py @@ -149,7 +149,7 @@ class TestTestingFunctions(unittest.TestCase): def test_registerView_with_permission_denying(self): from repoze.bfg import testing - from repoze.bfg.security import Unauthorized + from repoze.bfg.exceptions import Forbidden def view(context, request): """ """ view = testing.registerView('moo.html', view=view, permission='bar') @@ -157,7 +157,7 @@ class TestTestingFunctions(unittest.TestCase): import types self.failUnless(isinstance(view, types.FunctionType)) from repoze.bfg.view import render_view_to_response - self.assertRaises(Unauthorized, render_view_to_response, + self.assertRaises(Forbidden, render_view_to_response, None, None, 'moo.html') def test_registerView_with_permission_denying2(self): diff --git a/repoze/bfg/tests/test_view.py b/repoze/bfg/tests/test_view.py index edbfa120f..32c9d391b 100644 --- a/repoze/bfg/tests/test_view.py +++ b/repoze/bfg/tests/test_view.py @@ -467,14 +467,14 @@ class TestMultiView(unittest.TestCase): self.assertEqual(mv.views, [(99, 'view2'), (100, 'view')]) def test_match_not_found(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound mv = self._makeOne() context = DummyContext() request = DummyRequest() self.assertRaises(NotFound, mv.match, context, request) def test_match_predicate_fails(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound mv = self._makeOne() def view(context, request): """ """ @@ -496,7 +496,7 @@ class TestMultiView(unittest.TestCase): self.assertEqual(result, view) def test_permitted_no_views(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound mv = self._makeOne() context = DummyContext() request = DummyRequest() @@ -527,14 +527,14 @@ class TestMultiView(unittest.TestCase): self.assertEqual(result, False) def test__call__not_found(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound mv = self._makeOne() context = DummyContext() request = DummyRequest() self.assertRaises(NotFound, mv, context, request) def test___call__intermediate_not_found(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound mv = self._makeOne() context = DummyContext() request = DummyRequest() @@ -561,7 +561,7 @@ class TestMultiView(unittest.TestCase): self.assertEqual(response, expected_response) def test__call_permissive__not_found(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound mv = self._makeOne() context = DummyContext() request = DummyRequest() @@ -1408,7 +1408,7 @@ class TestDeriveView(unittest.TestCase): "'view_name' against context None): True") def test_view_with_debug_authorization_permission_authpol_denied(self): - from repoze.bfg.security import Unauthorized + from repoze.bfg.exceptions import Forbidden def view(context, request): """ """ self._registerSettings(debug_authorization=True, reload_templates=True) @@ -1422,7 +1422,7 @@ class TestDeriveView(unittest.TestCase): request = DummyRequest() request.view_name = 'view_name' request.url = 'url' - self.assertRaises(Unauthorized, result, None, request) + self.assertRaises(Forbidden, result, None, request) self.assertEqual(len(logger.messages), 1) self.assertEqual(logger.messages[0], "debug_authorization of url url (view name " @@ -1462,7 +1462,7 @@ class TestDeriveView(unittest.TestCase): self.assertEqual(predicates, [True, True]) def test_view_with_predicates_notall(self): - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound def view(context, request): """ """ predicates = [] diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py index 89ad71cac..35584f301 100644 --- a/repoze/bfg/tests/test_zcml.py +++ b/repoze/bfg/tests/test_zcml.py @@ -573,7 +573,7 @@ class TestViewDirective(unittest.TestCase): from zope.interface import Interface from repoze.bfg.interfaces import IRequest from repoze.bfg.interfaces import IView - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound context = DummyContext() class IFoo(Interface): pass @@ -626,7 +626,7 @@ class TestViewDirective(unittest.TestCase): from zope.interface import Interface from repoze.bfg.interfaces import IRequest from repoze.bfg.interfaces import IView - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound context = DummyContext() class IFoo(Interface): pass @@ -679,7 +679,7 @@ class TestViewDirective(unittest.TestCase): from zope.interface import Interface from repoze.bfg.interfaces import IRequest from repoze.bfg.interfaces import IView - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound context = DummyContext() class IFoo(Interface): pass @@ -735,7 +735,7 @@ class TestViewDirective(unittest.TestCase): from zope.interface import Interface from repoze.bfg.interfaces import IRequest from repoze.bfg.interfaces import IView - from repoze.bfg.view import NotFound + from repoze.bfg.exceptions import NotFound context = DummyContext() class IFoo(Interface): pass |
