[Checkins] SVN: PluggableAuthService/trunk/tests/ * adding test code for the image property type in UserPropertySheet

Rob Miller ra at burningman.com
Wed May 16 16:57:35 EDT 2007


Log message for revision 75814:
  * adding test code for the image property type in UserPropertySheet
  

Changed:
  A   PluggableAuthService/trunk/tests/image.gif
  U   PluggableAuthService/trunk/tests/test_UserPropertySheet.py

-=-
Added: PluggableAuthService/trunk/tests/image.gif
===================================================================
(Binary files differ)


Property changes on: PluggableAuthService/trunk/tests/image.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: PluggableAuthService/trunk/tests/test_UserPropertySheet.py
===================================================================
--- PluggableAuthService/trunk/tests/test_UserPropertySheet.py	2007-05-16 20:33:36 UTC (rev 75813)
+++ PluggableAuthService/trunk/tests/test_UserPropertySheet.py	2007-05-16 20:57:34 UTC (rev 75814)
@@ -13,10 +13,17 @@
 #
 ##############################################################################
 import unittest
+import os.path
 from DateTime.DateTime import DateTime
 
+from OFS.Image import Image
+
 from conformance import IPropertySheet_conformance
 
+path = os.path.dirname(__file__)
+path = os.path.join(path, 'image.gif')
+img_file = open(path, 'r')
+
 class UserPropertySheetTests( unittest.TestCase
                             , IPropertySheet_conformance
                             ):
@@ -29,6 +36,7 @@
               , ( 'l', 'lines'   )
               , ( 't', 'lines'   )
               , ( 'b', 'boolean' )
+              , ( 'img', 'image' )
               )
 
     _STRING_VALUE = 'string'
@@ -39,6 +47,7 @@
     _LIST_VALUE = [ 'a', 'b', 'c' ]
     _TUPLE_VALUE = ( 'd', 'e', 'f' )
     _BOOL_VALUE = True
+    _IMG_VALUE = Image('image', 'Test Image', img_file)
 
     def _getTargetClass( self ):
 
@@ -81,6 +90,7 @@
         self.failUnless( ups.hasProperty( 'l' ) )
         self.failUnless( ups.hasProperty( 't' ) )
         self.failUnless( ups.hasProperty( 'b' ) )
+        self.failUnless( ups.hasProperty( 'img' ) )
 
         self.assertEqual( ups.getPropertyType( 's' ), 'string' )
         self.assertEqual( ups.propertyInfo( 's' )[ 'type' ], 'string' )
@@ -150,6 +160,18 @@
             for i in range( len( self._TUPLE_VALUE ) ):
                 self.assertEqual( got[i], self._TUPLE_VALUE[i] )
 
+        self.assertEqual( ups.getPropertyType( 'img' ), 'image' )
+        self.assertEqual( ups.propertyInfo( 'img' )[ 'type' ], 'image' )
+
+        if values_are_none:
+            self.assertEqual( ups.getProperty( 'img' ), None )
+        else:
+            got = ups.getProperty( 'img' )
+            self.assertEqual( type( got ), Image )
+            self.assertEqual( got.size, self._IMG_VALUE.size )
+            self.assertEqual( got, self._IMG_VALUE )
+
+
         pmap = ups.propertyMap()
         self.assertEqual( len( pmap ), len( self._SCHEMA ) )
 
@@ -172,6 +194,7 @@
                            , l=self._LIST_VALUE
                            , t=self._TUPLE_VALUE
                            , b=self._BOOL_VALUE
+                           , img=self._IMG_VALUE
                            )
 
         self._checkStockSchema( ups )
@@ -189,6 +212,7 @@
                            , l=self._LIST_VALUE
                            , t=self._TUPLE_VALUE
                            , b=self._BOOL_VALUE
+                           , img=self._IMG_VALUE
                            )
 
         self._checkStockSchema( ups )



More information about the Checkins mailing list