Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFDefault.tests.test_MembershipTool.MembershipToolSecurityTests Class Reference
Inheritance diagram for CMFDefault.tests.test_MembershipTool.MembershipToolSecurityTests:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.tests.test_MembershipTool.MembershipToolSecurityTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_createMemberArea

Public Attributes

 site

Private Member Functions

def _makeOne

Detailed Description

Definition at line 71 of file test_MembershipTool.py.


Member Function Documentation

Definition at line 73 of file test_MembershipTool.py.

00073 
00074     def _makeOne(self, *args, **kw):
00075         from Products.CMFDefault.MembershipTool import MembershipTool
00076 
00077         return MembershipTool(*args, **kw)

Definition at line 78 of file test_MembershipTool.py.

00078 
00079     def setUp(self):
00080         SecurityTest.setUp(self)
00081         self.site = DummySite('site').__of__(self.root)
00082         self.site._setObject( 'portal_membership', self._makeOne() )

Definition at line 83 of file test_MembershipTool.py.

00083 
00084     def tearDown(self):
00085         cleanUp()
00086         SecurityTest.tearDown(self)

Here is the call graph for this function:

Definition at line 87 of file test_MembershipTool.py.

00087 
00088     def test_createMemberArea(self):
00089         mtool = self.site.portal_membership
00090         members = self.site._setObject( 'Members', PortalFolder('Members') )
00091         acl_users = self.site._setObject( 'acl_users', DummyUserFolder() )
00092         wtool = self.site._setObject( 'portal_workflow', DummyTool() )
00093 
00094         # permission
00095         mtool.createMemberArea('user_foo')
00096         self.failIf( hasattr(members.aq_self, 'user_foo') )
00097         newSecurityManager(None, acl_users.user_bar)
00098         mtool.createMemberArea('user_foo')
00099         self.failIf( hasattr(members.aq_self, 'user_foo') )
00100         newSecurityManager(None, acl_users.user_foo)
00101         mtool.setMemberareaCreationFlag()
00102         mtool.createMemberArea('user_foo')
00103         self.failIf( hasattr(members.aq_self, 'user_foo') )
00104         newSecurityManager(None, acl_users.all_powerful_Oz)
00105         mtool.setMemberareaCreationFlag()
00106         mtool.createMemberArea('user_foo')
00107         self.failUnless( hasattr(members.aq_self, 'user_foo') )
00108 
00109         # default content
00110         f = members.user_foo
00111         ownership = acl_users.user_foo
00112         localroles = ( ( 'user_foo', ('Owner',) ), )
00113         self.assertEqual( f.Title(), "user_foo's Home" )
00114         self.assertEqual( f.getOwner(), ownership )
00115         self.assertEqual( f.get_local_roles(), localroles,
00116                           'CMF Collector issue #162 (LocalRoles broken): %s'
00117                           % str( f.get_local_roles() ) )
00118         self.assertEqual( f.index_html.getOwner(), ownership,
00119                           'CMF Collector issue #162 (Ownership broken): %s'
00120                           % str( f.index_html.getOwner() ) )
00121         self.assertEqual( f.index_html.get_local_roles(), localroles,
00122                           'CMF Collector issue #162 (LocalRoles broken): %s'
00123                           % str( f.index_html.get_local_roles() ) )
00124         self.assertEqual( wtool.test_notified, f.index_html )
00125 
00126         # acquisition
00127         self.site.user_bar = 'test attribute'
00128         newSecurityManager(None, acl_users.user_bar)
00129         mtool.createMemberArea('user_bar')
00130         self.failUnless( hasattr(members.aq_self, 'user_bar'),
00131                          'CMF Collector issue #102 (acquisition bug)' )
00132 


Member Data Documentation

Definition at line 80 of file test_MembershipTool.py.


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