[CMF-checkins] CVS: Products/CMFCore/tests - test_TypesTool.py:1.35

Jens Vagelpohl jens at dataflake.org
Mon Nov 22 06:56:28 EST 2004


Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv9876/CMFCore/tests

Modified Files:
	test_TypesTool.py 
Log Message:
- TypesTool: Changed the way available factory_type_informations are
  presented on the dropdown list when adding a new type from a
  filesystem FTI to the Types Tool. The new representation includes
  the "id" as set in the FTI instead of just the product name and the
  meta_type. (http://www.zope.org/Collectors/CMF/49)


=== Products/CMFCore/tests/test_TypesTool.py 1.34 => 1.35 ===
--- Products/CMFCore/tests/test_TypesTool.py:1.34	Tue Sep 14 15:02:21 2004
+++ Products/CMFCore/tests/test_TypesTool.py	Mon Nov 22 06:56:28 2004
@@ -96,6 +96,37 @@
             self.fail('CMF Collector issue #165 (Ownership bug): '
                       'Unauthorized raised' )
 
+    def test_CMFCollector_49(self):
+        """http://www.zope.org/Collectors/CMF/49
+
+        If you have two FTIs on the file system, both with the same meta_type
+        but with different id values, the way listDefaultTypeInformation 
+        listed them in the dropdown list made it impossible to distinguish
+        the two because the identifier string only contained the CMF package
+        name and the meta_type
+        """
+        import copy
+        # Extreme nastiness: Fake out a /Control_Panel/Products registry
+        # inside the fake site by putting dummy objects with a
+        # factory_type_information attribute on them...
+        fti1 = copy.deepcopy(FTIDATA_DUMMY)
+        fti2 = copy.deepcopy(FTIDATA_DUMMY)
+        fti2[0]['id'] = 'Other Content'
+        product1 = DummyObject('product1')
+        product1.factory_type_information = fti1 + fti2
+        self.site._setObject('product1', product1)
+        def fakeGetProducts(*ign, **igntoo):
+            return self.site
+        def fakeObjectValues(*ign, **igntoo):
+            return (self.site.product1,)
+        self.ttool._getProducts = fakeGetProducts
+        self.site.objectValues = fakeObjectValues
+
+        types = self.ttool.listDefaultTypeInformation()
+        dropdown_representation = [x[0] for x in types]
+        self.failIf(dropdown_representation[0]==dropdown_representation[1])
+
+
 def test_interface(self):
         from Products.CMFCore.interfaces.portal_types \
                 import portal_types as ITypesTool



More information about the CMF-checkins mailing list