Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
CMFDefault.tests.test_join.MembershipTests Class Reference

List of all members.

Public Member Functions

def afterSetUp
def test_join
def test_join_memberproperties
def test_join_without_email
def test_join_with_variable_id_policies

Static Public Attributes

 layer = FunctionalLayer

Detailed Description

Definition at line 26 of file test_join.py.


Member Function Documentation

Definition at line 30 of file test_join.py.

00030 
00031     def afterSetUp(self):
00032         setSite(self.app.site)

Definition at line 33 of file test_join.py.

00033 
00034     def test_join( self ):
00035         site = self.app.site
00036         member_id = 'test_user'
00037 
00038         site.portal_registration.addMember( member_id
00039                                           , 'zzyyzz'
00040                                           , properties={ 'username': member_id
00041                                                        , 'email' : 'foo@bar.com'
00042                                                        }
00043                                           )
00044         u = site.acl_users.getUser(member_id)
00045         self.failUnless(u)

Definition at line 46 of file test_join.py.

00046 
00047     def test_join_memberproperties(self):
00048         # Make sure the member data wrapper carries correct properties
00049         # after joining
00050         site = self.app.site
00051         member_id = 'test_user'
00052 
00053         site.portal_registration.addMember( member_id
00054                                           , 'zzyyzz'
00055                                           , properties={ 'username': member_id
00056                                                        , 'email' : 'foo@bar.com'
00057                                                        }
00058                                           )
00059 
00060         m = site.portal_membership.getMemberById('test_user')
00061         self.assertEqual(m.getProperty('email'), 'foo@bar.com')
00062         self.assertEqual(m.getMemberId(), member_id)
00063         self.assertEqual(m.getRoles(), ('Member', 'Authenticated'))

Definition at line 74 of file test_join.py.

00074 
00075     def test_join_with_variable_id_policies( self ):
00076         site = self.app.site
00077         member_id = 'test.user'
00078 
00079         # Test with the default policy: Names with "." should fail
00080         self.assertRaises(ValueError,
00081                           site.portal_registration.addMember,
00082                           member_id,
00083                           'zzyyzz',
00084                           properties={ 'username':'Test User'
00085                                      , 'email': 'foo@bar.com'
00086                                      }
00087                           )
00088 
00089         # Now change the policy to allow "."
00090         new_pattern = "^[A-Za-z][A-Za-z0-9_\.]*$"
00091         site.portal_registration.manage_editIDPattern(new_pattern)
00092         site.portal_registration.addMember( member_id
00093                                           , 'zzyyzz'
00094                                           , properties={ 'username': 'TestUser2'
00095                                                        , 'email' : 'foo@bar.com'
00096                                                        }
00097                                           )
00098         u = site.acl_users.getUser(member_id)
00099         self.failUnless(u)
00100 

Definition at line 64 of file test_join.py.

00064 
00065     def test_join_without_email( self ):
00066         site = self.app.site
00067 
00068         self.assertRaises(ValueError,
00069                           site.portal_registration.addMember,
00070                           'test_user',
00071                           'zzyyzz',
00072                           properties={'username':'test_user', 'email': ''}
00073                           )


Member Data Documentation

Definition at line 28 of file test_join.py.


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