[Checkins] SVN: PluggableAuthService/trunk/ - Add missing interface for IPropertiedUser and tests

Jens Vagelpohl jens at dataflake.org
Tue Apr 18 17:56:23 EDT 2006


Log message for revision 67083:
  - Add missing interface for IPropertiedUser and tests
    (http://www.zope.org/Collectors/PAS/16)
  

Changed:
  U   PluggableAuthService/trunk/PropertiedUser.py
  U   PluggableAuthService/trunk/doc/CHANGES.txt
  U   PluggableAuthService/trunk/interfaces/authservice.py
  U   PluggableAuthService/trunk/tests/conformance.py
  U   PluggableAuthService/trunk/tests/test_PropertiedUser.py

-=-
Modified: PluggableAuthService/trunk/PropertiedUser.py
===================================================================
--- PluggableAuthService/trunk/PropertiedUser.py	2006-04-18 21:42:29 UTC (rev 67082)
+++ PluggableAuthService/trunk/PropertiedUser.py	2006-04-18 21:56:22 UTC (rev 67083)
@@ -21,7 +21,9 @@
 from AccessControl.User import BasicUser
 from AccessControl.PermissionRole import _what_not_even_god_should_do
 
+from interfaces.authservice import IPropertiedUser
 from UserPropertySheet import UserPropertySheet
+from utils import classImplements
 
 class PropertiedUser( BasicUser ):
 
@@ -281,3 +283,7 @@
             raise KeyError, "Duplicate property sheet: %s" % id
 
         self._propertysheets[ id ] = UserPropertySheet( id, **data )
+
+
+classImplements( PropertiedUser,
+                 IPropertiedUser )

Modified: PluggableAuthService/trunk/doc/CHANGES.txt
===================================================================
--- PluggableAuthService/trunk/doc/CHANGES.txt	2006-04-18 21:42:29 UTC (rev 67082)
+++ PluggableAuthService/trunk/doc/CHANGES.txt	2006-04-18 21:56:22 UTC (rev 67083)
@@ -7,21 +7,24 @@
       - Fix manage_zmi_logout which stopped working correctly as soon as the
         PluggableAuthService product code was installed by correcting the
         monkeypatch for it in __init__.py.
-        (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/12)
+        (http://www.zope.org/Collectors/PAS/12)
 
+      - Add missing interface for IPropertiedUser and tests
+        (http://www.zope.org/Collectors/PAS/16)
+
     Other
 
       - Removed STX links from README.txt which do nothing but return 
         404s when clicked from the README on zope.org.
-        (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/6)
+        (http://www.zope.org/Collectors/PAS/6)
 
       - Fixing up inconsistent searching in the listAvailablePrincipals
         method of the ZODBRoleManager and ZODBGroupManager plugins. Now both
         constrain searches by ID.
-        (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/11)
+        (http://www.zope.org/Collectors/PAS/11)
 
       - Convert from using zLOG to using the Python logging module.
-        (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/14)
+        (http://www.zope.org/Collectors/PAS/14)
 
 
   PluggableAuthService 1.2-beta (2006/02/25)

Modified: PluggableAuthService/trunk/interfaces/authservice.py
===================================================================
--- PluggableAuthService/trunk/interfaces/authservice.py	2006-04-18 21:42:29 UTC (rev 67082)
+++ PluggableAuthService/trunk/interfaces/authservice.py	2006-04-18 21:56:22 UTC (rev 67083)
@@ -68,6 +68,36 @@
         """
 
 
+class IPropertiedUser( IBasicUser ):
+
+    """ A user which has property sheets associated with it,
+        i.e. a mapping from strings (property sheet ids)
+        to objects implementing IPropertySheet
+    """
+
+    def listPropertysheets():
+
+        """ Return a sequence of property sheet ids
+
+        o for each id in the list getPropertysheet(id)
+          returns a IPropertySheet
+        """
+
+    def getPropertysheet( id ):
+
+        """ Return a property sheet for the given id
+
+        o the returned object implements IPropertySheet
+          and has the same id as the value passed to this method
+
+        o if there is no property sheet for the given id,
+          raise a KeyError
+
+          An alternative way to get the property sheet is via item access,
+          i.e. user.getPropertysheet( id ) == user[ id ]
+        """
+
+
 class IUserFolder( Interface ):
 
     """ Specify the interface called out in AccessControl.User.BasicUserFolder

Modified: PluggableAuthService/trunk/tests/conformance.py
===================================================================
--- PluggableAuthService/trunk/tests/conformance.py	2006-04-18 21:42:29 UTC (rev 67082)
+++ PluggableAuthService/trunk/tests/conformance.py	2006-04-18 21:56:22 UTC (rev 67083)
@@ -183,7 +183,24 @@
 
         verifyClass( IUserFolder, self._getTargetClass() )
 
+class IBasicUser_conformance:
 
+    def test_conformance_IBasicUser( self ):
+
+        from Products.PluggableAuthService.interfaces.authservice \
+            import IBasicUser
+
+        verifyClass( IBasicUser, self._getTargetClass() )
+
+class IPropertiedUser_conformance:
+
+    def test_conformance_IPropertiedUser( self ):
+
+        from Products.PluggableAuthService.interfaces.authservice \
+            import IPropertiedUser
+
+        verifyClass( IPropertiedUser, self._getTargetClass() )
+
 class IPropertySheet_conformance:
 
     def test_conformance_IPropertySheet( self ):

Modified: PluggableAuthService/trunk/tests/test_PropertiedUser.py
===================================================================
--- PluggableAuthService/trunk/tests/test_PropertiedUser.py	2006-04-18 21:42:29 UTC (rev 67082)
+++ PluggableAuthService/trunk/tests/test_PropertiedUser.py	2006-04-18 21:56:22 UTC (rev 67083)
@@ -15,6 +15,8 @@
 import unittest
 
 from Acquisition import Implicit
+from conformance import IBasicUser_conformance, \
+                        IPropertiedUser_conformance
 
 class FauxMethod:
 
@@ -29,7 +31,10 @@
 
         self.__ac_local_roles__ = local_roles
 
-class PropertiedUserTests( unittest.TestCase ):
+class PropertiedUserTests( unittest.TestCase
+                           , IBasicUser_conformance
+                           , IPropertiedUser_conformance
+                           ):
 
     def _getTargetClass( self ):
 
@@ -94,6 +99,7 @@
         self.assertEqual( len( sheet.propertyMap() ), 2 )
         self.assertEqual( sheet.getPropertyType( 'a' ), 'int' )
         self.assertEqual( sheet.getPropertyType( 'b' ), 'string' )
+        self.assertEqual( sheet.getId(), 'one' )
 
         sheet = user[ 'one' ]
 
@@ -280,4 +286,4 @@
     return unittest.TestSuite((
         unittest.makeSuite( PropertiedUserTests ),
         ))
-    
\ No newline at end of file
+    



More information about the Checkins mailing list