Back to index

plone3  3.1.7
Public Member Functions
Archetypes.tests.test_classgen.ClassGenSecurityTest Class Reference

List of all members.

Public Member Functions

def test_security_dont_stomp_existing_decl_perm
def test_security_dont_stomp_existing_decl_public
def test_security_dont_stomp_existing_decl_private
def test_security_protect_manual_method
def test_security_protect_generate_method

Detailed Description

Definition at line 240 of file test_classgen.py.


Member Function Documentation

Definition at line 242 of file test_classgen.py.

00242 
00243     def test_security_dont_stomp_existing_decl_perm(self):
00244         self.failIf(hasattr(SecDummy1, '__ac_permissions__'))
00245         self.failUnless(hasattr(SecDummy1, 'makeFoo'))
00246         existing_method = getattr(SecDummy1, 'makeFoo')
00247         generateMethods(SecDummy1, (foo_field,))
00248         self.failUnless(hasattr(SecDummy1, '__ac_permissions__'))
00249         self.failUnless(SecDummy1.makeFoo == existing_method)
00250         got = SecDummy1.__ac_permissions__
00251         expected = (('Modify portal content',
00252                      ('setFoo', 'getRawFoo')),
00253                      ('View', ('makeFoo',)),)
00254         self.assertEquals(got, expected)

Definition at line 270 of file test_classgen.py.

00270 
00271     def test_security_dont_stomp_existing_decl_private(self):
00272         self.failIf(hasattr(SecDummy5, '__ac_permissions__'))
00273         self.failIf(hasattr(SecDummy5, 'makeFoo__roles__'))
00274         self.failUnless(hasattr(SecDummy5, 'makeFoo'))
00275         existing_method = getattr(SecDummy5, 'makeFoo')
00276         generateMethods(SecDummy5, (foo_field,))
00277         self.failUnless(hasattr(SecDummy5, '__ac_permissions__'))
00278         self.failUnless(SecDummy5.makeFoo == existing_method)
00279         got = SecDummy5.__ac_permissions__
00280         expected = (('Modify portal content',
00281                      ('setFoo', 'getRawFoo')),)
00282         self.assertEquals(got, expected)
00283         self.failUnless(hasattr(SecDummy5, 'makeFoo__roles__'))
00284         self.failUnless(SecDummy5.makeFoo__roles__ == ACCESS_PRIVATE)

Definition at line 255 of file test_classgen.py.

00255 
00256     def test_security_dont_stomp_existing_decl_public(self):
00257         self.failIf(hasattr(SecDummy4, '__ac_permissions__'))
00258         self.failIf(hasattr(SecDummy4, 'makeFoo__roles__'))
00259         self.failUnless(hasattr(SecDummy4, 'makeFoo'))
00260         existing_method = getattr(SecDummy4, 'makeFoo')
00261         generateMethods(SecDummy4, (foo_field,))
00262         self.failUnless(hasattr(SecDummy4, '__ac_permissions__'))
00263         self.failUnless(SecDummy4.makeFoo == existing_method)
00264         got = SecDummy4.__ac_permissions__
00265         expected = (('Modify portal content',
00266                      ('setFoo', 'getRawFoo')),)
00267         self.assertEquals(got, expected)
00268         self.failUnless(hasattr(SecDummy4, 'makeFoo__roles__'))
00269         self.failUnless(SecDummy4.makeFoo__roles__ == ACCESS_PUBLIC)

Definition at line 297 of file test_classgen.py.

00297 
00298     def test_security_protect_generate_method(self):
00299         self.failIf(hasattr(SecDummy3, '__ac_permissions__'))
00300         self.failIf(hasattr(SecDummy3, 'makeFoo'))
00301         generateMethods(SecDummy3, (foo_field,))
00302         self.failUnless(hasattr(SecDummy3, '__ac_permissions__'))
00303         self.failUnless(hasattr(SecDummy3, 'makeFoo'))
00304         got = SecDummy3.__ac_permissions__
00305         expected = (('Modify portal content',
00306                      ('makeFoo', 'setFoo', 'getRawFoo')),)
00307         self.assertEquals(got, expected)

Definition at line 285 of file test_classgen.py.

00285 
00286     def test_security_protect_manual_method(self):
00287         self.failIf(hasattr(SecDummy2, '__ac_permissions__'))
00288         self.failUnless(hasattr(SecDummy2, 'makeFoo'))
00289         existing_method = getattr(SecDummy2, 'makeFoo')
00290         generateMethods(SecDummy2, (foo_field,))
00291         self.failUnless(hasattr(SecDummy2, '__ac_permissions__'))
00292         self.failUnless(SecDummy2.makeFoo == existing_method)
00293         got = SecDummy2.__ac_permissions__
00294         expected = (('Modify portal content',
00295                      ('makeFoo', 'setFoo', 'getRawFoo')),)
00296         self.assertEquals(got, expected)


The documentation for this class was generated from the following file: