[CMF-checkins] CVS: CMF/CMFSetup/tests - test_actions.py:1.9.2.2
test_typeinfo.py:1.10.2.2
Yvo Schubbe
y.2005- at wcm-solutions.de
Wed Apr 13 09:05:03 EDT 2005
Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv14280/CMFSetup/tests
Modified Files:
Tag: CMF-1_5-branch
test_actions.py test_typeinfo.py
Log Message:
more improvements for extension profiles:
- implemented 'remove' for action providers
- refactored typeinfo imports to allow modifying existing typeinfos (doesn't work for single type actions)
=== CMF/CMFSetup/tests/test_actions.py 1.9.2.1 => 1.9.2.2 ===
--- CMF/CMFSetup/tests/test_actions.py:1.9.2.1 Tue Dec 14 15:56:26 2004
+++ CMF/CMFSetup/tests/test_actions.py Wed Apr 13 09:05:02 2005
@@ -262,6 +262,18 @@
</actions-tool>
"""
+_REMOVE_IMPORT = """\
+<?xml version="1.0"?>
+<actions-tool>
+ <action-provider id="portal_actions" remove="">
+ </action-provider>
+ <action-provider id="not_existing" remove="">
+ </action-provider>
+ <action-provider id="portal_bar" remove="">
+ </action-provider>
+</actions-tool>
+"""
+
class Test_exportActionProviders( _ActionSetup ):
@@ -398,6 +410,22 @@
self.failUnless( 'portal_bar' in atool.listActionProviders() )
self.failUnless( bar.listActions() )
self.failUnless( 'portal_actions' in atool.listActionProviders() )
+
+ def test_remove_skip_purge(self):
+
+ from Products.CMFSetup.actions import importActionProviders
+
+ site = self._initSite(2, 2)
+ atool = site.portal_actions
+
+ self.assertEqual( atool.listActionProviders(),
+ ['portal_actions', 'portal_foo', 'portal_bar'] )
+
+ context = DummyImportContext(site, False)
+ context._files['actions.xml'] = _REMOVE_IMPORT
+ importActionProviders(context)
+
+ self.assertEqual( atool.listActionProviders(), ['portal_foo'] )
def test_suite():
=== CMF/CMFSetup/tests/test_typeinfo.py 1.10.2.1 => 1.10.2.2 ===
--- CMF/CMFSetup/tests/test_typeinfo.py:1.10.2.1 Tue Dec 14 15:56:26 2004
+++ CMF/CMFSetup/tests/test_typeinfo.py Wed Apr 13 09:05:02 2005
@@ -34,11 +34,10 @@
from common import DummyImportContext
-class DummyTypeInfo( SimpleItem ):
+class DummyTypeInfo(SimpleItem):
- def __init__( self, info ):
+ pass
- self.__dict__.update( info )
class DummyTypesTool( Folder ):
@@ -450,6 +449,13 @@
</types-tool>
"""
+_UPDATE_TOOL_IMPORT = """\
+<?xml version="1.0"?>
+<types-tool>
+ <type id="foo"/>
+</types-tool>
+"""
+
_FOO_EXPORT = """\
<type-info
id="%s"
@@ -556,6 +562,15 @@
</type-info>
"""
+_UPDATE_FOO_IMPORT = """\
+<type-info id="foo">
+ <aliases>
+ <alias from="spam" to="eggs"/>
+ </aliases>
+</type-info>
+"""
+
+
class Test_exportTypesTool( _TypeInfoSetup ):
def test_empty( self ):
@@ -706,6 +721,39 @@
self.assertEqual( len( tool.objectIds() ), 2 )
self.failUnless( 'foo object' in tool.objectIds() )
self.failUnless( 'bar object' in tool.objectIds() )
+
+ def test_fragment_skip_purge_ascii(self):
+
+ from Products.CMFSetup.typeinfo import importTypesTool
+
+ site = self._initSite()
+ tool = site.portal_types
+
+ context = DummyImportContext(site, encoding='ascii')
+ context._files['typestool.xml'] = _NORMAL_TOOL_EXPORT
+ context._files['types/foo.xml'] = _FOO_EXPORT % 'foo'
+ context._files['types/bar.xml'] = _BAR_EXPORT % 'bar'
+ importTypesTool(context)
+
+ self.assertEqual( tool.foo.title, 'Foo' )
+ self.assertEqual( tool.foo.content_meta_type, 'Foo Thing' )
+ self.assertEqual( tool.foo.content_icon, 'foo.png' )
+ self.assertEqual( tool.foo.immediate_view, 'foo_view' )
+ self.assertEqual( tool.foo._aliases,
+ {'(Default)': 'foo_view', 'view': 'foo_view'} )
+
+ context = DummyImportContext(site, False, encoding='ascii')
+ context._files['typestool.xml'] = _UPDATE_TOOL_IMPORT
+ context._files['types/foo.xml'] = _UPDATE_FOO_IMPORT
+ importTypesTool(context)
+
+ self.assertEqual( tool.foo.title, 'Foo' )
+ self.assertEqual( tool.foo.content_meta_type, 'Foo Thing' )
+ self.assertEqual( tool.foo.content_icon, 'foo.png' )
+ self.assertEqual( tool.foo.immediate_view, 'foo_view' )
+ self.assertEqual( tool.foo._aliases,
+ {'(Default)': 'foo_view', 'view': 'foo_view', 'spam': 'eggs'} )
+
def test_suite():
return unittest.TestSuite((
More information about the CMF-checkins
mailing list