[Zope-CVS] CVS: Products/PluggableAuthService/tests - test_PluggableAuthService.py:1.18

Zachery Bir zbir at urbanape.com
Fri May 27 15:10:55 EDT 2005


Update of /cvs-repository/Products/PluggableAuthService/tests
In directory cvs.zope.org:/tmp/cvs-serv19919/tests

Modified Files:
	test_PluggableAuthService.py 
Log Message:
applied Mark Hammond's patch


=== Products/PluggableAuthService/tests/test_PluggableAuthService.py 1.17 => 1.18 ===
--- Products/PluggableAuthService/tests/test_PluggableAuthService.py:1.17	Fri May 27 14:55:45 2005
+++ Products/PluggableAuthService/tests/test_PluggableAuthService.py	Fri May 27 15:10:45 2005
@@ -1209,6 +1209,28 @@
         user = zcuf.getUser( 'bar at example.com' )
         self.assertEqual( user.getId(), 'bar+bar' )
 
+    def test_getUser_id_and_name( self ):
+        # Tests fetching a user by ID versus fetching by username.
+        from Products.PluggableAuthService.interfaces.plugins \
+             import IUserEnumerationPlugin
+
+        plugins = self._makePlugins()
+        zcuf = self._makeOne( plugins )
+
+        bar = self._makeUserEnumerator( 'bar', 'bar at example.com' )
+        bar.identifier = 'bar/'
+        zcuf._setObject( 'bar', bar )
+
+        zcuf.plugins.activatePlugin(IUserEnumerationPlugin, 'bar')
+        # Fetch the new user by ID and name, and check we get the same.
+        user = zcuf.getUserById('bar/bar')
+        self.assertEqual( user.getId(), 'bar/bar')
+        self.assertEqual( user.getUserName(), 'bar at example.com' )
+
+        user2 = zcuf.getUser('bar at example.com')
+        self.assertEqual( user2.getId(), 'bar/bar')
+        self.assertEqual( user2.getUserName(), 'bar at example.com' )
+
     def test_simple_getUserGroups_with_Groupplugin(self):
 
         from Products.PluggableAuthService.interfaces.plugins \



More information about the Zope-CVS mailing list