Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def addMember
def testSetPortrait
def testDeletePortrait
def testPruneMemberDataContents
def testFulltextMemberSearch
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 memberdata
 membership

Detailed Description

Definition at line 14 of file testMemberDataTool.py.


Member Function Documentation

def CMFPlone.tests.testMemberDataTool.TestMemberDataTool.addMember (   self,
  username,
  fullname,
  email,
  roles,
  last_login_time 
)

Definition at line 29 of file testMemberDataTool.py.

00029 
00030     def addMember(self, username, fullname, email, roles, last_login_time):
00031         self.membership.addMember(username, 'secret', roles, [])
00032         member = self.membership.getMemberById(username)
00033         member.setMemberProperties({'fullname': fullname, 'email': email,
00034                                     'last_login_time': DateTime(last_login_time),})

Here is the caller graph for this function:

Definition at line 16 of file testMemberDataTool.py.

00016 
00017     def afterSetUp(self):
00018         self.memberdata = self.portal.portal_memberdata
00019         self.membership = self.portal.portal_membership
00020         self.membership.memberareaCreationFlag = 0
00021         # Don't let default_user disturb results
00022         self.portal.acl_users._doDelUsers([default_user])
00023         # Add some members
00024         self.addMember('fred', 'Fred Flintstone', 'fred@bedrock.com', ['Member', 'Reviewer'], '2002-01-01')
00025         self.addMember('barney', 'Barney Rubble', 'barney@bedrock.com', ['Member'], '2002-01-01')
00026         self.addMember('brubble', 'Bambam Rubble', 'bambam@bambam.net', ['Member'], '2003-12-31')
00027         # MUST reset this
00028         self.memberdata._v_temps = None

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 40 of file testMemberDataTool.py.

00040 
00041     def testDeletePortrait(self):
00042         self.memberdata._setPortrait(Image(id=default_user, file=dummy.File(), title=''), default_user)
00043         self.memberdata._deletePortrait(default_user)
00044         self.assertEqual(self.memberdata._getPortrait(default_user), None)

Definition at line 52 of file testMemberDataTool.py.

00052 
00053     def testFulltextMemberSearch(self):
00054         # Search for a user by id, name, email, ...
00055         search = self.memberdata.searchFulltextForMembers
00056         self.assertEqual(len(search('')), 3)
00057         self.assertEqual(len(search('rubble')), 2)
00058         self.assertEqual(len(search('stone')), 1)
00059         self.assertEqual(len(search('bambam.net')), 1)
00060         self.assertEqual(len(search('bedrock.com')), 2)
00061         self.assertEqual(len(search('brubble')), 1)
00062 

Definition at line 45 of file testMemberDataTool.py.

00045 
00046     def testPruneMemberDataContents(self):
00047         # Only test what is not already tested elswhere
00048         self.memberdata._setPortrait(Image(id=default_user, file=dummy.File(), title=''), default_user)
00049         self.memberdata._setPortrait(Image(id=default_user, file=dummy.File(), title=''), 'dummy')
00050         self.memberdata.pruneMemberDataContents()
00051         self.assertEqual(len(self.memberdata.portraits.objectIds()), 1)

Definition at line 35 of file testMemberDataTool.py.

00035 
00036     def testSetPortrait(self):
00037         self.memberdata._setPortrait(Image(id=default_user, file=dummy.File(), title=''), default_user)
00038         self.assertEqual(self.memberdata._getPortrait(default_user).getId(), default_user)
00039         self.assertEqual(self.memberdata._getPortrait(default_user).meta_type, 'Image')


Member Data Documentation

Definition at line 17 of file testMemberDataTool.py.

Definition at line 18 of file testMemberDataTool.py.


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