Back to index

plone3  3.1.7
Classes | Functions | Variables
GroupUserFolder.tests.testMultipleSources Namespace Reference

Classes

class  ManagementOpener
class  UnauthorizedOpener
class  TestMultipleSources

Functions

def Log
def build
 self.folder.acl_users._doAddGroup('ng6', (), ('ng5', 'ng6', ))
def test01addSources
def test02getDefaultSource
def test03userFetching
def test04ChangeUserRole
def test05AvailableTypes
def test06LUFSource
def test_suite

Variables

string __version__ = "$Revision: $"
 GroupUserFolder Copyright (C)2006 Ingeniweb.
string __docformat__ = 'restructuredtext'
tuple app = ZopeTestCase.app()
string base = 'http://%s:%d/%s'
 LOG_DEBUG = None
 LOG_NOTICE = None
 LOG_WARNING = None
 LOG_ERROR = None
 LOG_CRITICAL = None

Function Documentation

self.folder.acl_users._doAddGroup('ng6', (), ('ng5', 'ng6', ))

self.folder.acl_users._doAddUser('u12', 'secret', (), (), ('ng5', 'ng6', ), ) # Create a few folders to play with

Definition at line 171 of file testMultipleSources.py.

00171 
00172     def build(self,):
00173         self.folder.acl_users.addUserSource("manage_addProduct/OFSP/manage_addUserFolder")

Definition at line 90 of file testMultipleSources.py.

00090 
00091     def Log(*args, **kw):
        pass

Here is the caller graph for this function:

Add a few user sources

Definition at line 174 of file testMultipleSources.py.

00174 
00175     def test01addSources(self,):
00176         """Add a few user sources"""
00177         self.folder.acl_users.addUserSource("manage_addProduct/OFSP/manage_addUserFolder")
00178         self.failUnless('Users01' in self.folder.acl_users.objectIds())
00179         self.failUnless(self.folder.acl_users.Users01.getId() == 'Users01')
00180         self.failUnless('acl_users' in self.folder.acl_users.Users01.objectIds())
00181         self.failUnless(not self.folder.acl_users.listUserSources()[-1].getUserNames())

Here is the call graph for this function:

Definition at line 182 of file testMultipleSources.py.

00182 
00183     def test02getDefaultSource(self,):
00184         "Test default source retreiving"
00185         self.build()
00186         #Log(LOG_DEBUG, self.getDefaultUserSource().getId())
00187         self.failUnless(self.folder.acl_users.getDefaultUserSource().getId() == 'acl_users')

Definition at line 188 of file testMultipleSources.py.

00188 
00189     def test03userFetching(self,):
00190         "Test user creation & fetching"
00191         self.build()
00192         self.failUnless(self.folder.acl_users.listUserSources()[-1].aq_parent.id == 'Users01')
00193         self.failUnless(self.folder.acl_users.listUserSources()[-1].meta_type == 'User Folder')
00194         self.folder.acl_users.listUserSources()[-1]._doAddUser('U1_01', 'secret', (), (), )
00195         self.failUnless(self.folder.acl_users.listUserSources()[-1].getUserNames() == ['U1_01'])
00196         U1 = self.folder.acl_users.getUser('U1_01')
00197         self.folder.acl_users.getUser('u1')
00198         self.failUnless(self.folder.acl_users.getUser('U1_01').getUserSourceId() == 'Users01')
00199         self.failUnless(self.folder.acl_users.getUnwrappedUser("U1_01").name == 'U1_01')

Here is the call graph for this function:

Definition at line 200 of file testMultipleSources.py.

00200 
00201     def test04ChangeUserRole(self,):
00202         "Test if it possible to change a user's role using the sources API"
00203         self.setRoles(["Manager"])
00204         user = getSecurityManager().getUser()
00205         Log(LOG_DEBUG, user.getRoles())
00206         self.failUnless(user.has_role("Manager"))

Here is the call graph for this function:

Definition at line 207 of file testMultipleSources.py.

00207 
00208     def test05AvailableTypes(self,):
00209         "test available user folders"
00210         self.setRoles(["Manager", ])
00211         self.failUnless(getSecurityManager().getUser().has_role("Manager"))
00212         sources = self.folder.acl_users.listAvailableUserSources(filter_permissions = 0, filter_classes = 1)
00213         self.failUnless(
00214             ('User Folder', "manage_addProduct/OFSP/manage_addUserFolder") in sources,
00215             "There should only have one UF, not %s" % (sources, ))

Here is the call graph for this function:

Definition at line 216 of file testMultipleSources.py.

00216 
00217     def test06LUFSource(self):
00218         # Make sure this method returns only one LDAP User Folder
00219         gruf = self.folder.acl_users
00220 
00221         # Make sure the default returns None
00222         self.failUnlessEqual(gruf.getLUFSource(), None) 
00223 
00224         # Now try to test with an LDAP User Folder
00225         try:
00226             gruf.replaceUserSource(
00227                 "Users",
00228                 "manage_addProduct/LDAPUserFolder/manage_addLDAPUserFolder",
00229                 )
00230         except AttributeError: # No LDAP user folder installed so bail
00231             return
00232 
00233         # Make sure it now returns an LDAP user folder
00234         self.failUnlessEqual(gruf.getLUFSource().meta_type, 'LDAPUserFolder') 
00235 
00236         # Now add another and make sure it still picks the LDAP user folder
00237         gruf.addUserSource("manage_addProduct/OFSP/manage_addUserFolder")
00238         self.failUnlessEqual(gruf.getLUFSource().meta_type, 'LDAPUserFolder') 
00239 
00240 

Definition at line 245 of file testMultipleSources.py.

00245 
00246     def test_suite():
00247         suite = unittest.TestSuite()
00248         suite.addTest(unittest.makeSuite(TestMultipleSources))
00249         return suite

Variable Documentation

Definition at line 24 of file testMultipleSources.py.

GroupUserFolder Copyright (C)2006 Ingeniweb.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Definition at line 21 of file testMultipleSources.py.

Definition at line 44 of file testMultipleSources.py.

Definition at line 50 of file testMultipleSources.py.

Definition at line 89 of file testMultipleSources.py.

Definition at line 85 of file testMultipleSources.py.

Definition at line 88 of file testMultipleSources.py.

Definition at line 86 of file testMultipleSources.py.

Definition at line 87 of file testMultipleSources.py.