CVS: Products/GenericSetup/tests - test_properties.py:1.2 test_tool.py:1.2

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Update of /cvs-repository/Products/GenericSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv19329/tests

Modified Files:
	test_properties.py test_tool.py 
Log Message:
 - Forward-port fixes from CMFSetup.


=== Products/GenericSetup/tests/test_properties.py 1.1.1.1 => 1.2 ===
--- Products/GenericSetup/tests/test_properties.py:1.1.1.1	Mon Aug  8 15:38:37 2005
+++ Products/GenericSetup/tests/test_properties.py	Fri Sep 23 13:29:21 2005
@@ -42,6 +42,8 @@
   <property name="foo" type="string">Foo</property>
   <property name="bar" type="tokens">
    <element value="Bar"/></property>
+  <property name="moo" type="tokens">
+   <element value="Moo"/></property>
 </site>
 """
 
@@ -65,8 +67,10 @@
 
         if bar > 0:
             site._setProperty( 'bar', (), 'tokens' )
+            site._setProperty( 'moo', (), 'tokens' )
         if bar > 1:
             site._updateProperty( 'bar', ('Bar',) )
+            site.moo = ['Moo']
 
         return site
 
@@ -91,6 +95,11 @@
                        'value': '',
                        'elements': ('Bar',),
                        'type': 'tokens',
+                       'select_variable': None },
+                     { 'id': 'moo',
+                       'value': '',
+                       'elements': ('Moo',),
+                       'type': 'tokens',
                        'select_variable': None } ]
 
         configurator = self._makeOne(site)
@@ -129,7 +138,7 @@
         configurator = self._makeOne(site)
         site_info = configurator.parseXML(_NORMAL_EXPORT)
 
-        self.assertEqual( len( site_info['properties'] ), 2 )
+        self.assertEqual( len( site_info['properties'] ), 3 )
 
         info = site_info['properties'][0]
         self.assertEqual( info['id'], 'foo' )
@@ -180,7 +189,7 @@
 
         site = self._initSite()
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -198,7 +207,7 @@
 
         site = self._initSite()
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -216,7 +225,7 @@
 
         site = self._initSite()
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -228,7 +237,7 @@
         from Products.GenericSetup.properties import importSiteProperties
         importSiteProperties(context)
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -246,7 +255,7 @@
         from Products.GenericSetup.properties import importSiteProperties
         importSiteProperties(context)
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )
@@ -264,7 +273,7 @@
         from Products.GenericSetup.properties import importSiteProperties
         importSiteProperties(context)
 
-        self.assertEqual( len( site.propertyIds() ), 2 )
+        self.assertEqual( len( site.propertyIds() ), 3 )
         self.failUnless( 'foo' in site.propertyIds() )
         self.assertEqual( site.getProperty('foo'), 'Foo' )
         self.failUnless( 'bar' in site.propertyIds() )


=== Products/GenericSetup/tests/test_tool.py 1.1.1.1 => 1.2 ===
--- Products/GenericSetup/tests/test_tool.py:1.1.1.1	Mon Aug  8 15:38:37 2005
+++ Products/GenericSetup/tests/test_tool.py	Fri Sep 23 13:29:21 2005
@@ -738,6 +738,24 @@
 
 class Test_importToolset( _ToolsetSetup ):
 
+    def test_tool_ids( self ):
+        # The tool import mechanism used to rely on the fact that all tools
+        # have unique IDs set at the class level and that you can call their
+        # constructor with no arguments. However, there might be tools
+        # that need IDs set.
+        from Products.GenericSetup.tool import TOOLSET_XML
+        from Products.GenericSetup.tool import importToolset
+
+        site = self._initSite()
+        context = DummyImportContext( site )
+        context._files[ TOOLSET_XML ] = _REQUIRED_TOOLSET_XML
+
+        importToolset( context )
+
+        for tool_id in ( 'mandatory', 'obligatory' ):
+            tool = getattr( site, tool_id )
+            self.assertEqual( tool.getId(), tool_id )
+
     def test_forbidden_tools( self ):
 
         from Products.GenericSetup.tool import TOOLSET_XML

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.