summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_security.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-25 01:37:25 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-25 01:37:25 +0000
commit7d1da854e77b56ab6e50f0b8a3e0e61d8ebfb7a7 (patch)
treec90afb9a21697481fd272555fd9c60da31ffd72b /repoze/bfg/tests/test_security.py
parent267f2db66f514db43d0801237213799cd6797ee4 (diff)
downloadpyramid-7d1da854e77b56ab6e50f0b8a3e0e61d8ebfb7a7.tar.gz
pyramid-7d1da854e77b56ab6e50f0b8a3e0e61d8ebfb7a7.tar.bz2
pyramid-7d1da854e77b56ab6e50f0b8a3e0e61d8ebfb7a7.zip
IForbiddenAppFactory -> IForbiddenResponseFactory.
Diffstat (limited to 'repoze/bfg/tests/test_security.py')
-rw-r--r--repoze/bfg/tests/test_security.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/repoze/bfg/tests/test_security.py b/repoze/bfg/tests/test_security.py
index ffac19e0d..b9f9624d4 100644
--- a/repoze/bfg/tests/test_security.py
+++ b/repoze/bfg/tests/test_security.py
@@ -245,14 +245,12 @@ class TestACLSecurityPolicy(unittest.TestCase):
def test_forbidden(self):
policy = self._makeOne(lambda *arg: None)
- forbidden_app = policy.forbidden(None, None)
- environ = {}
- result = []
- def start_response(status, headers):
- result.append((status, headers))
- response = forbidden_app(environ, start_response)
- self.assertEqual(result[0][0], '401 Unauthorized')
- self.failUnless(len(result[0][1]), 2) # headers
+ context = DummyContext()
+ request = DummyRequest({})
+ response = policy.forbidden(context, request)
+ self.failUnless('401 Unauthorized' in response.app_iter[0])
+ self.assertEqual(response.status, '401 Unauthorized')
+ self.assertEqual(len(response.headerlist), 2)
class TestInheritingACLSecurityPolicy(unittest.TestCase):
@@ -444,14 +442,12 @@ class TestInheritingACLSecurityPolicy(unittest.TestCase):
def test_forbidden(self):
policy = self._makeOne(lambda *arg: None)
- forbidden_app = policy.forbidden(None, None)
- environ = {}
- result = []
- def start_response(status, headers):
- result.append((status, headers))
- response = forbidden_app(environ, start_response)
- self.assertEqual(result[0][0], '401 Unauthorized')
- self.failUnless(len(result[0][1]), 2) # headers
+ context = DummyContext()
+ request = DummyRequest({})
+ response = policy.forbidden(context, request)
+ self.failUnless('401 Unauthorized' in response.app_iter[0])
+ self.assertEqual(response.status, '401 Unauthorized')
+ self.assertEqual(len(response.headerlist), 2)
class TestAllPermissionsList(unittest.TestCase):
def setUp(self):