195 with self.temporary_permissions((rdef, {'read': ()})): |
195 with self.temporary_permissions((rdef, {'read': ()})): |
196 self.assertEqual(rdef.permissions['read'], ()) |
196 self.assertEqual(rdef.permissions['read'], ()) |
197 self.assertTrue(rdef.permissions['add']) |
197 self.assertTrue(rdef.permissions['add']) |
198 self.assertTrue(rdef.permissions['read'], ()) |
198 self.assertTrue(rdef.permissions['read'], ()) |
199 |
199 |
|
200 def test_temporary_permissions_rdef_with_exception(self): |
|
201 rdef = self.schema['CWUser'].rdef('in_group') |
|
202 try: |
|
203 with self.temporary_permissions((rdef, {'read': ()})): |
|
204 self.assertEqual(rdef.permissions['read'], ()) |
|
205 self.assertTrue(rdef.permissions['add']) |
|
206 raise ValueError('goto') |
|
207 except ValueError: |
|
208 self.assertTrue(rdef.permissions['read'], ()) |
|
209 else: |
|
210 self.fail('exception was caught unexpectedly') |
|
211 |
200 def test_temporary_appobjects_registered(self): |
212 def test_temporary_appobjects_registered(self): |
201 |
213 |
202 class AnAppobject(object): |
214 class AnAppobject(object): |
203 __registries__ = ('hip',) |
215 __registries__ = ('hip',) |
204 __regid__ = 'hop' |
216 __regid__ = 'hop' |