Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testCreateMemberarea
def testCreatMemberareaUsesCurrentUser
def testNoMemberareaIfNoMembersFolder
def testNoMemberareaIfMemberareaExists
def testNotifyScriptIsCalled
def testCreateMemberareaAlternateName
def testCreateMemberareaLPF
def testCreateMemberareaWhenDisabled
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 membership

Detailed Description

Definition at line 359 of file testMembershipTool.py.


Member Function Documentation

Definition at line 361 of file testMembershipTool.py.

00361 
00362     def afterSetUp(self):
00363         self.membership = self.portal.portal_membership
00364         self.membership.addMember('user2', 'secret', ['Member'], [])

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 365 of file testMembershipTool.py.

00365 
00366     def testCreateMemberarea(self):
00367         # Should create a memberarea for user2
00368         if self.membership.memberareaCreationFlag == True:
00369             members = self.membership.getMembersFolder()
00370             self.membership.createMemberarea('user2')
00371             memberfolder = self.membership.getHomeFolder('user2')
00372             self.failUnless(memberfolder, 'createMemberarea failed to create memberarea')
00373             # member area creation should be on by default
00374             self.failUnless(self.membership.getMemberareaCreationFlag())

Definition at line 404 of file testMembershipTool.py.

00404 
00405     def testCreateMemberareaAlternateName(self):
00406         # Alternate method name 'createMemberaArea' should work
00407         if self.membership.memberareaCreationFlag == True:
00408             members = self.membership.getMembersFolder()
00409             self.membership.createMemberArea('user2')
00410             memberfolder = self.membership.getHomeFolder('user2')
00411             self.failUnless(memberfolder, 'createMemberArea failed to create memberarea')

Definition at line 412 of file testMembershipTool.py.

00412 
00413     def testCreateMemberareaLPF(self):
00414         # Should create a Large Plone Folder instead of a normal Folder
00415         if self.membership.memberareaCreationFlag == True:
00416             self.membership.setMemberAreaType('Large Plone Folder')
00417             self.membership.createMemberarea('user2')
00418             memberfolder = self.membership.getHomeFolder('user2')
00419             self.assertEqual(memberfolder.getPortalTypeName(), 'Large Plone Folder')

Definition at line 420 of file testMembershipTool.py.

00420 
00421     def testCreateMemberareaWhenDisabled(self):
00422         # Should not create a member area
00423         self.membership.setMemberareaCreationFlag = False
00424         self.failIf(self.membership.getMemberareaCreationFlag())
00425         self.membership.createMemberarea('user2')
00426         memberfolder = self.membership.getHomeFolder('user2')
00427         self.failIf(memberfolder, 'createMemberarea created memberarea despite flag')

Definition at line 375 of file testMembershipTool.py.

00375 
00376     def testCreatMemberareaUsesCurrentUser(self):
00377         if self.membership.memberareaCreationFlag == True:
00378             # Should create a memberarea for user2
00379             self.login('user2')
00380             self.membership.createMemberarea()
00381             memberfolder = self.membership.getHomeFolder('user2')
00382             self.failUnless(memberfolder, 'createMemberarea failed to create memberarea for current user')
00383         else:
00384             pass

Here is the call graph for this function:

Definition at line 392 of file testMembershipTool.py.

00392 
00393     def testNoMemberareaIfMemberareaExists(self):
00394         # Should not attempt to create a memberarea if a memberarea already exists
00395         self.membership.createMemberarea('user2')
00396         # The second call should do nothing (not cause an error)
00397         self.membership.createMemberarea('user2')

Definition at line 385 of file testMembershipTool.py.

00385 
00386     def testNoMemberareaIfNoMembersFolder(self):
00387         # Should not create a memberarea if the Members folder is missing
00388         self.portal._delObject('Members')
00389         self.membership.createMemberarea('user2')
00390         memberfolder = self.membership.getHomeFolder('user2')
00391         self.failIf(memberfolder, 'createMemberarea unexpectedly created a memberarea')

Definition at line 398 of file testMembershipTool.py.

00398 
00399     def testNotifyScriptIsCalled(self):
00400         # The notify script should be called
00401         if self.membership.memberareaCreationFlag == True:
00402             self.portal.notifyMemberAreaCreated = dummy.Raiser(dummy.Error)
00403             self.assertRaises(dummy.Error, self.membership.createMemberarea, 'user2')       


Member Data Documentation

Definition at line 362 of file testMembershipTool.py.


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