Ejemplo n.º 1
0
 def test_enumerate_fails(self):
     from AccessControl import Unauthorized
     from AccessControl.ZopeGuards import guarded_enumerate
     sm = SecurityManager(reject=True)
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1, 2, 3])
     self.assertRaises(Unauthorized, enum.next)
     self.setSecurityManager(old)
Ejemplo n.º 2
0
 def test_enumerate_fails(self):
     from AccessControl import Unauthorized
     from AccessControl.ZopeGuards import guarded_enumerate
     sm = SecurityManager(1) # rejects
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1,2,3])
     self.assertRaises(Unauthorized, enum.next)
     self.setSecurityManager(old)
Ejemplo n.º 3
0
 def test_enumerate_succeeds(self):
     sm = SecurityManager() # accepts
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1,2,3])
     self.assertEqual(enum.next(), (0,1))
     self.assertEqual(enum.next(), (1,2))
     self.assertEqual(enum.next(), (2,3))
     self.assertRaises(StopIteration, enum.next)
     self.setSecurityManager(old)
Ejemplo n.º 4
0
 def test_enumerate_succeeds(self):
     sm = SecurityManager() # accepts
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1,2,3])
     self.assertEqual(enum.next(), (0,1))
     self.assertEqual(enum.next(), (1,2))
     self.assertEqual(enum.next(), (2,3))
     self.assertRaises(StopIteration, enum.next)
     self.setSecurityManager(old)
Ejemplo n.º 5
0
 def test_enumerate_succeeds(self):
     from AccessControl.ZopeGuards import guarded_enumerate
     sm = SecurityManager()  # accepts
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1, 2, 3])
     self.assertEqual(next(enum), (0, 1))
     self.assertEqual(next(enum), (1, 2))
     self.assertEqual(next(enum), (2, 3))
     self.assertRaises(StopIteration, enum.next)
     self.setSecurityManager(old)
Ejemplo n.º 6
0
 def test_enumerate_fails(self):
     sm = SecurityManager(1) # rejects
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1,2,3])
     self.assertRaises(Unauthorized, enum.next)
     self.setSecurityManager(old)
Ejemplo n.º 7
0
 def test_enumerate_fails(self):
     sm = SecurityManager(1) # rejects
     old = self.setSecurityManager(sm)
     enum = guarded_enumerate([1,2,3])
     self.assertRaises(Unauthorized, enum.next)
     self.setSecurityManager(old)