Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
PlonePAS.tests.test_membership_tool.MembershipToolTest Class Reference
Inheritance diagram for PlonePAS.tests.test_membership_tool.MembershipToolTest:
Inheritance graph
[legend]
Collaboration diagram for PlonePAS.tests.test_membership_tool.MembershipToolTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_get_member
def test_get_member_by_id
def test_id_clean

Public Attributes

 mt
 md
 member_id

Detailed Description

Definition at line 32 of file test_membership_tool.py.


Member Function Documentation

Definition at line 34 of file test_membership_tool.py.

00034 
00035     def afterSetUp(self):
00036         self.mt = mt = getToolByName(self.portal, 'portal_membership')
00037         self.md = md = getToolByName(self.portal, 'portal_memberdata')
00038 
00039         self.member_id = 'member1'
00040         # Create a new Member
00041         mt.addMember(self.member_id, 'pw', ['Member'], [],
00042                      {'email': 'member1@host.com',
00043                       'title': 'Member #1'})

Definition at line 44 of file test_membership_tool.py.

00044 
00045     def test_get_member(self):
00046         member = self.portal.acl_users.getUserById(self.member_id)
00047         self.failIf(member is None)
00048 
00049         # Should be wrapped into the PAS.
00050         got = aq_base(aq_parent(member))
00051         expected = aq_base(self.portal.acl_users)
00052         self.assertEquals(got, expected)
00053 
00054         self.failUnless(isinstance(member, PloneUser))

Definition at line 55 of file test_membership_tool.py.

00055 
00056     def test_get_member_by_id(self):
00057         # Use tool way of getting member by id. This returns a
00058         # MemberData object wrapped by the member
00059         member = self.mt.getMemberById(self.member_id)
00060         self.failIf(member is None)
00061         self.failUnless(isinstance(member, MemberData))
00062         self.failUnless(isinstance(aq_parent(member), PloneUser))

Definition at line 63 of file test_membership_tool.py.

00063 
00064     def test_id_clean(self):
00065         from Products.PlonePAS.utils import cleanId, decleanId
00066         a = [
00067              "asdfasdf",
00068              "asdf-asdf",
00069              "asdf--asdf",
00070              "asdf---asdf",
00071              "asdf----asdf",
00072              "asdf-----asdf",
00073              "asdf%asdf",
00074              "asdf%%asdf",
00075              "asdf%%%asdf",
00076              "asdf%%%%asdf",
00077              "asdf%%%%%asdf",
00078              "asdf-%asdf",
00079              "asdf%-asdf",
00080              "asdf-%-asdf",
00081              "asdf%-%asdf",
00082              "asdf--%asdf",
00083              "asdf%--asdf",
00084              "asdf--%-asdf",
00085              "asdf-%--asdf",
00086              "asdf--%--asdf",
00087              "asdf%-%asdf",
00088              "asdf%--%asdf",
00089              "asdf%---%asdf",
00090              "-asdf",
00091              "--asdf",
00092              "---asdf",
00093              "----asdf",
00094              "-----asdf",
00095              "asdf-",
00096              "asdf--",
00097              "asdf---",
00098              "asdf----",
00099              "asdf-----",
00100              "%asdf",
00101              "%%asdf",
00102              "%%%asdf",
00103              "%%%%asdf",
00104              "%%%%%asdf",
00105              "asdf%",
00106              "asdf%%",
00107              "asdf%%%",
00108              "asdf%%%%",
00109              "asdf%%%%%",
00110              "asdf\x00asdf",
00111         ]
00112         b = [cleanId(id) for id in a]
00113         c = [decleanId(id) for id in b]
00114         ac = zip(a,c)
00115         for aa, cc in ac:
00116             self.failUnless(aa==cc)

Here is the call graph for this function:


Member Data Documentation

Definition at line 36 of file test_membership_tool.py.

Definition at line 38 of file test_membership_tool.py.

Definition at line 35 of file test_membership_tool.py.


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