Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testJoinCreatesUser
def testJoinWithUppercaseEmailCreatesUser
def testJoinWithoutEmailRaisesValueError
def testJoinWithBadEmailRaisesValueError
def testJoinAsExistingMemberRaisesValueError
def testJoinAsExistingNonMemberUserRaisesValueError
def testJoinWithPortalIdAsUsernameRaisesValueError
def testJoinWithoutPermissionRaisesUnauthorized
def testJoinWithoutPermissionRaisesUnauthorizedFormScript
def testNewIdAllowed
def testTakenUserId
def testTakenGroupd
def testIsMemberIdAllowedIfSubstringOfExisting
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 registration

Detailed Description

Definition at line 13 of file testRegistrationTool.py.


Member Function Documentation

Definition at line 15 of file testRegistrationTool.py.

00015 
00016     def afterSetUp(self):
00017         self.registration = self.portal.portal_registration
00018         self.portal.acl_users.userFolderAddUser("userid", "password",
00019                 (), (), ())
00020         self.portal.acl_users._doAddGroup("groupid", ())

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 90 of file testRegistrationTool.py.

00090 
00091     def testIsMemberIdAllowedIfSubstringOfExisting(self):
00092         # http://dev.plone.org/plone/ticket/6396
00093         self.failUnless(self.registration.isMemberIdAllowed('useri'))
00094         

Definition at line 45 of file testRegistrationTool.py.

00045 
00046     def testJoinAsExistingMemberRaisesValueError(self):
00047         self.assertRaises(ValueError,
00048                           self.registration.addMember,
00049                           PloneTestCase.default_user, 'secret',
00050                           properties={'username': 'Dr FooBar', 'email': 'foo@bar.com'})

Definition at line 51 of file testRegistrationTool.py.

00051 
00052     def testJoinAsExistingNonMemberUserRaisesValueError(self):
00053         # http://dev.plone.org/plone/ticket/3221
00054         self.portal.acl_users._doAddUser(member_id, 'secret', [], [])
00055         self.assertRaises(ValueError,
00056                           self.registration.addMember,
00057                           member_id, 'secret',
00058                           properties={'username': member_id, 'email': 'foo@bar.com'})

Definition at line 21 of file testRegistrationTool.py.

00021 
00022     def testJoinCreatesUser(self):
00023         self.registration.addMember(member_id, 'secret',
00024                           properties={'username': member_id, 'email': 'foo@bar.com'})
00025         user = self.portal.acl_users.getUserById(member_id)
00026         self.failUnless(user, 'addMember failed to create user')

Definition at line 39 of file testRegistrationTool.py.

00039 
00040     def testJoinWithBadEmailRaisesValueError(self):
00041         self.assertRaises(ValueError,
00042                           self.registration.addMember,
00043                           member_id, 'secret',
00044                           properties={'username': member_id, 'email': 'foo@bar.com, fred@bedrock.com'})

Definition at line 33 of file testRegistrationTool.py.

00033 
00034     def testJoinWithoutEmailRaisesValueError(self):
00035         self.assertRaises(ValueError,
00036                           self.registration.addMember,
00037                           member_id, 'secret',
00038                           properties={'username': member_id, 'email': ''})

Definition at line 65 of file testRegistrationTool.py.

00065 
00066     def testJoinWithoutPermissionRaisesUnauthorized(self):
00067         # http://dev.plone.org/plone/ticket/3000
00068         self.portal.manage_permission(AddPortalMember, ['Manager'], acquire=0)
00069         self.assertRaises(Unauthorized,
00070                           self.registration.restrictedTraverse, 'addMember')

Definition at line 71 of file testRegistrationTool.py.

00071 
00072     def testJoinWithoutPermissionRaisesUnauthorizedFormScript(self):
00073         # http://dev.plone.org/plone/ticket/3000
00074         self.portal.manage_permission(AddPortalMember, ['Manager'], acquire=0)
00075         self.app.REQUEST['username'] = member_id
00076         # TODO: register has a proxy role but we trip over
00077         # validate_registration... (2.0.5)
00078         self.assertRaises(Unauthorized, self.portal.register)

Definition at line 59 of file testRegistrationTool.py.

00059 
00060     def testJoinWithPortalIdAsUsernameRaisesValueError(self):
00061         self.assertRaises(ValueError,
00062                           self.registration.addMember,
00063                           self.portal.getId(), 'secret',
00064                           properties={'username': 'Dr FooBar', 'email': 'foo@bar.com'})

Definition at line 27 of file testRegistrationTool.py.

00027 
00028     def testJoinWithUppercaseEmailCreatesUser(self):
00029         self.registration.addMember(member_id, 'secret',
00030                           properties={'username': member_id, 'email': 'FOO@BAR.COM'})
00031         user = self.portal.acl_users.getUserById(member_id)
00032         self.failUnless(user, 'addMember failed to create user')

Definition at line 79 of file testRegistrationTool.py.

00079 
00080     def testNewIdAllowed(self):
00081         self.assertEqual(self.registration.isMemberIdAllowed('newuser'), 1)
00082 

Definition at line 87 of file testRegistrationTool.py.

00087 
00088     def testTakenGroupd(self):
00089         self.assertEqual(self.registration.isMemberIdAllowed('groupid'), 0)

Definition at line 83 of file testRegistrationTool.py.

00083 
00084     def testTakenUserId(self):
00085         self.assertEqual(self.registration.isMemberIdAllowed('userid'), 0)
00086 


Member Data Documentation

Definition at line 16 of file testRegistrationTool.py.


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