Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testMembershipTool.TestSearchForMembers Class Reference
Inheritance diagram for CMFPlone.tests.testMembershipTool.TestSearchForMembers:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testMembershipTool.TestSearchForMembers:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def addMember
def testSearchById
def testSearchByName
def testSearchByEmail
def testSearchByRoles
def testSearchByNameAndEmail
def testSearchByNameAndRoles
def testSearchByEmailAndRoles
def beforeTearDown
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 memberdata
 membership

Detailed Description

Definition at line 471 of file testMembershipTool.py.


Member Function Documentation

def CMFPlone.tests.testMembershipTool.TestSearchForMembers.addMember (   self,
  username,
  fullname,
  email,
  roles,
  last_login_time 
)

Definition at line 493 of file testMembershipTool.py.

00493 
00494     def addMember(self, username, fullname, email, roles, last_login_time):
00495         self.membership.addMember(username, 'secret', roles, [])
00496         member = self.membership.getMemberById(username)
00497         member.setMemberProperties({'fullname': fullname, 'email': email,
00498                                     'last_login_time': DateTime(last_login_time),})

Here is the caller graph for this function:

Definition at line 473 of file testMembershipTool.py.

00473 
00474     def afterSetUp(self):
00475         self.memberdata = self.portal.portal_memberdata
00476         self.membership = self.portal.portal_membership
00477         # Don't let default_user disturb results
00478         self.portal.acl_users._doDelUsers([default_user])
00479         # Add some members
00480         self.addMember('fred', 'Fred Flintstone',
00481                        'fred@bedrock.com', ['Member', 'Reviewer'],
00482                        '2002-01-01')
00483         self.addMember('barney', 'Barney Rubble',
00484                        'barney@bedrock.com', ['Member'],
00485                        '2002-01-01')
00486         self.addMember('brubble', 'Bambam Rubble',
00487                        'bambam@bambam.net', ['Member'],
00488                        '2003-12-31')
00489         # MUST reset this
00490         self.memberdata._v_temps = None
00491         self._trap_warning_output()
00492 

Definition at line 539 of file testMembershipTool.py.

00539 
00540     def beforeTearDown(self):
00541         self._free_warning_output()
00542 

Here is the call graph for this function:

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 512 of file testMembershipTool.py.

00512 
00513     def testSearchByEmail(self):
00514         search = self.membership.searchForMembers
00515         self.assertEqual(len(search(email='bedrock')), 2)
00516         self.assertEqual(len(search(email='bambam')), 1)

Definition at line 534 of file testMembershipTool.py.

00534 
00535     def testSearchByEmailAndRoles(self):
00536         search = self.membership.searchForMembers
00537         self.assertEqual(len(search(email='fred', roles=['Reviewer'])), 1)
00538         self.assertEqual(len(search(email='fred', roles=['Manager'])), 0)

Definition at line 499 of file testMembershipTool.py.

00499 
00500     def testSearchById(self):
00501         # Should search id and fullname
00502         search = self.membership.searchForMembers
00503         self.assertEqual(len(search(name='brubble')), 0)
00504         self.assertEqual(len(search(name='barney')), 1)
00505         self.assertEqual(len(search(name='rubble')), 2)

Definition at line 506 of file testMembershipTool.py.

00506 
00507     def testSearchByName(self):
00508         # Should search id and fullname
00509         search = self.membership.searchForMembers
00510         self.assertEqual(len(search(name='rubble')), 2)
00511         self.assertEqual(len(search(name='stone')), 1)

Definition at line 523 of file testMembershipTool.py.

00523 
00524     def testSearchByNameAndEmail(self):
00525         search = self.membership.searchForMembers
00526         self.assertEqual(len(search(name='rubble', email='bedrock')), 1)
00527         self.assertEqual(len(search(name='bambam', email='bedrock')), 0)

Definition at line 528 of file testMembershipTool.py.

00528 
00529     def testSearchByNameAndRoles(self):
00530         search = self.membership.searchForMembers
00531         self.assertEqual(len(search(name='fred', roles=['Reviewer'])), 1)
00532         self.assertEqual(len(search(name='fred', roles=['Manager'])), 0)
00533 

Definition at line 517 of file testMembershipTool.py.

00517 
00518     def testSearchByRoles(self):
00519         search = self.membership.searchForMembers
00520         self.assertEqual(len(search(roles=['Member'])), 3)
00521         self.assertEqual(len(search(roles=['Reviewer'])), 1)
00522 


Member Data Documentation

Definition at line 474 of file testMembershipTool.py.

Definition at line 475 of file testMembershipTool.py.


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