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

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


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

Modified Files:
      Tag: CMF-1_5-branch
	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.32.2.1 => 1.32.2.2 ===
--- Products/CMFCore/tests/test_TypesTool.py:1.32.2.1	Tue Sep  7 04:47:54 2004
+++ Products/CMFCore/tests/test_TypesTool.py	Mon Nov 22 06:55:59 2004
@@ -103,6 +103,36 @@
         self.failUnless(meta_types.has_key('Scriptable Type Information'))
         self.failUnless(meta_types.has_key('Factory-based Type Information'))
 
+    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_constructContent(self):
         site = self.site
         acl_users = self.acl_users



More information about the CMF-checkins mailing list