Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFCore.tests.test_MemberDataTool.MemberDataToolTests Class Reference

List of all members.

Public Member Functions

def tearDown
def test_z2interfaces
def test_z3interfaces
def test_deleteMemberData
def test_pruneMemberData

Private Member Functions

def _makeOne

Detailed Description

Definition at line 67 of file test_MemberDataTool.py.


Member Function Documentation

def CMFCore.tests.test_MemberDataTool.MemberDataToolTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 69 of file test_MemberDataTool.py.

00069 
00070     def _makeOne(self, *args, **kw):
00071         from Products.CMFCore.MemberDataTool import MemberDataTool
00072 
00073         return MemberDataTool(*args, **kw)

Definition at line 74 of file test_MemberDataTool.py.

00074 
00075     def tearDown(self):
00076         cleanUp()

Here is the call graph for this function:

Definition at line 92 of file test_MemberDataTool.py.

00092 
00093     def test_deleteMemberData(self):
00094         tool = self._makeOne()
00095         tool.registerMemberData('Dummy', 'user_foo')
00096         self.failUnless( tool._members.has_key('user_foo') )
00097         self.failUnless( tool.deleteMemberData('user_foo') )
00098         self.failIf( tool._members.has_key('user_foo') )
00099         self.failIf( tool.deleteMemberData('user_foo') )

Here is the call graph for this function:

Definition at line 100 of file test_MemberDataTool.py.

00100 
00101     def test_pruneMemberData(self):
00102         # This needs a tad more setup
00103         from OFS.Folder import Folder
00104         from Products.CMFCore.MembershipTool import MembershipTool
00105         folder = Folder('test')
00106         folder._setObject('portal_memberdata', self._makeOne())
00107         folder._setObject('portal_membership', MembershipTool())
00108         folder._setObject('acl_users', DummyUserFolder())
00109         tool = folder.portal_memberdata
00110 
00111         # Create some members
00112         for i in range(20):
00113             tool.registerMemberData( 'Dummy_%i' % i
00114                                    , 'user_foo_%i' % i
00115                                    )
00116 
00117         # None of these fake members are in the user folder, which means
00118         # there are 20 members and 20 "orphans"
00119         contents = tool.getMemberDataContents()
00120         info_dict = contents[0]
00121         self.assertEqual(info_dict['member_count'], 20)
00122         self.assertEqual(info_dict['orphan_count'], 20)
00123 
00124         # Calling the prune method should delete all orphans, so we end
00125         # up with no members in the tool.
00126         tool.pruneMemberDataContents()
00127         contents = tool.getMemberDataContents()
00128         info_dict = contents[0]
00129         self.assertEqual(info_dict['member_count'], 0)
00130         self.assertEqual(info_dict['orphan_count'], 0)
00131 

Here is the call graph for this function:

Definition at line 77 of file test_MemberDataTool.py.

00077 
00078     def test_z2interfaces(self):
00079         from Interface.Verify import verifyClass
00080         from Products.CMFCore.interfaces.portal_memberdata \
00081                 import portal_memberdata as IMemberDataTool
00082         from Products.CMFCore.MemberDataTool import MemberDataTool
00083 
00084         verifyClass(IMemberDataTool, MemberDataTool)

Definition at line 85 of file test_MemberDataTool.py.

00085 
00086     def test_z3interfaces(self):
00087         from zope.interface.verify import verifyClass
00088         from Products.CMFCore.interfaces import IMemberDataTool
00089         from Products.CMFCore.MemberDataTool import MemberDataTool
00090 
00091         verifyClass(IMemberDataTool, MemberDataTool)


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