Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Private Attributes
PlonePAS.tests.test_migration.SanityCheck Class Reference

List of all members.

Public Member Functions

def __init__
def uf
def checkUserFolder
def checkUsers
def checkGroups
def populateUsers
def populateGroups
def run

Public Attributes

 portal
 tc

Static Private Attributes

tuple _users
tuple _groups
dictionary _group_members

Detailed Description

Definition at line 28 of file test_migration.py.


Constructor & Destructor Documentation

def PlonePAS.tests.test_migration.SanityCheck.__init__ (   self,
  testcase,
  portal 
)

Definition at line 80 of file test_migration.py.

00080 
00081     def __init__(self, testcase, portal):
00082         self.portal = portal
00083         self.tc = testcase


Member Function Documentation

Definition at line 122 of file test_migration.py.

00122 
00123     def checkGroups(self):
00124         gt = getToolByName(self.portal, 'portal_groups')
00125         gd = getToolByName(self.portal, 'portal_groupdata')
00126         propids = gd.propertyIds()
00127         for gid, groles, gsubs, gprops in self._groups:
00128             group = gt.getGroupById(gid)
00129             self.tc.failIf(group is None, gid)
00130 
00131             roles = [r for r in group.getRoles() if r != 'Authenticated']
00132             for role in groles:
00133                 self.tc.failUnless(role in roles, (gid, role, roles))
00134 
00135             # XXX fails currently because getGroupMembers tries to do
00136             # getUserById with the group id and PAS looks only at
00137             # IUserEnumeration.
00138             # members = group.getGroupMemberIds()
00139             # expected = self._group_members[gid]
00140             # for member in expected:
00141             #     self.tc.failUnless(member in members, (gid, member, members))
00142 
00143             # XXX This seems to be expected to break too.
00144             for k, v in gprops.items():
00145                 propval = group.getProperty(k, None)
00146                 self.tc.failUnless(propval == v, (gid, k, propval, v))

Here is the call graph for this function:

Definition at line 87 of file test_migration.py.

00087 
00088     def checkUserFolder(self):
00089         uf = self.uf()
00090         self.tc.failUnless(uf.meta_type == 'Pluggable Auth Service',
00091                            uf.meta_type)
00092         parent = aq_parent(aq_inner(uf))
00093         self.tc.failUnless(aq_base(parent) == aq_base(self.portal),
00094                            (parent, self.portal, uf))

Here is the call graph for this function:

Definition at line 95 of file test_migration.py.

00095 
00096     def checkUsers(self):
00097         mt = getToolByName(self.portal, 'portal_membership')
00098         md = getToolByName(self.portal, 'portal_memberdata')
00099         propids = md.propertyIds()
00100         uf = self.uf()
00101         for uid, upw, uroles, udomains, uprops in self._users:
00102             user = uf.getUserById(uid)
00103             self.tc.failIf(user is None, uid)
00104 
00105             # Ignore password check?
00106             # pw = user.getPassword()
00107             # self.tc.failUnless(pw == upw, (uid, pw, upw)
00108 
00109             roles = [r for r in user.getRoles() if r not in ('Authenticated',)]
00110             for role in uroles:
00111                 self.tc.failUnless(role in roles, (uid, role, roles))
00112 
00113             # Ignore domains check?
00114             # domains = user.getDomains()
00115             # self.tc.failUnless(domains == udomains, (uid, domains, udomains))
00116 
00117             member = mt.getMemberById(uid)
00118 
00119             for k, v in uprops.items():
00120                 propval = member.getProperty(k, None)
00121                 self.tc.failUnless(propval == v, (uid, k, propval, v))

Here is the call graph for this function:

Definition at line 157 of file test_migration.py.

00157 
00158     def populateGroups(self):
00159         gt = getToolByName(self.portal, 'portal_groups')
00160         for g in self._groups:
00161             try:
00162                 gt.addGroup(*g[:-1], **g[-1])
00163             except TypeError:
00164                 # GRUF 2.x doesn't accept properties in addgroup
00165                 gt.addGroup(g[0],"",*g[1:-1])   # old addGroup uses password
00166                 group = gt.getGroupById(g[0])
00167                 group.setGroupProperties(g[-1])
00168 
00169             gid = g[0]
00170             group = gt.getGroupById(gid)
00171             for mid in self._group_members[gid]:
00172                 group.addMember(mid)

Here is the call graph for this function:

Definition at line 147 of file test_migration.py.

00147 
00148     def populateUsers(self):
00149         mt = getToolByName(self.portal, 'portal_membership')
00150         for u in self._users:
00151             member = mt.getMemberById(u[0])
00152             if member is None:
00153                 mt.addMember(*u)
00154             else:
00155                 member.setMemberProperties(u[-1])
00156 

Here is the call graph for this function:

def PlonePAS.tests.test_migration.SanityCheck.run (   self,
  actions 
)

Definition at line 173 of file test_migration.py.

00173 
00174     def run(self, *actions):
00175         for name in actions:
00176             getattr(self, name)()

Definition at line 84 of file test_migration.py.

00084 
00085     def uf(self):
00086         return getToolByName(self.portal, 'acl_users')

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Initial value:
{
        'group0': ('user4',),
        'group1': ('user3',),
        'group2': ('user1', 'user2'),
        }

Definition at line 74 of file test_migration.py.

Initial value:
(
        ('group0', ['Member'], [],
         {'title': 'Group #0',
          'description': 'Group #0 Description',
          'email': 'group0@host.com',
          }
         ),
        ('group1', ['Member'], [],
         {'title': 'Group #1',
          'description': 'Group #1 Description',
          'email': 'group1@host.com',
          }
         ),
        ('group2', ['Reviewer'], ['group0'],
         {'title': 'Group #2',
          'description': 'Group #2 Description',
          'email': 'group2@host.com',
          }
         ),
        )

Definition at line 53 of file test_migration.py.

Initial value:
(
        ('user1', 'u1', ['Member'], [],
         {'email': 'user1@host.com',
          'fullname': 'User #1',
          }
         ),
        ('user2', 'u2', ['Member', 'Reviewer'], [],
         {'email': 'user2@host.com',
          'fullname': 'User #2',
          }
         ),
        ('user3', 'u3', [], [],
         {'email': 'user3@host.com',
          'fullname': 'User #3',
          }
         ),
        ('user4', 'u4', [], [],
         {'email': 'user4@host.com',
          'fullname': 'User #4',
          }
         ),
        )

Definition at line 30 of file test_migration.py.

Definition at line 81 of file test_migration.py.

Definition at line 82 of file test_migration.py.


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