[CMF-checkins] CVS: CMF/CMFSetup/tests - test_context.py:1.5
test_tool.py:1.8
Tres Seaver
tseaver at zope.com
Mon May 24 15:13:10 EDT 2004
Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv13420/tests
Modified Files:
test_context.py test_tool.py
Log Message:
- context.py:
o Add APIs for getting the snapshot Folder and its URL.
o Ensure that we don't choke on unicode XML.
o Fux big in ID of nested folder.
- tool.py:
o Implement 'createSnapshot'.
=== CMF/CMFSetup/tests/test_context.py 1.4 => 1.5 ===
--- CMF/CMFSetup/tests/test_context.py:1.4 Mon May 24 14:46:56 2004
+++ CMF/CMFSetup/tests/test_context.py Mon May 24 15:13:10 2004
@@ -488,6 +488,32 @@
self.assertEqual( template.read(), _XML )
self.failIf( template.html() )
+ def test_writeDataFile_unicode_xml( self ):
+
+ from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
+ _FILENAME = 'simple.xml'
+ _CONTENT_TYPE = 'text/xml'
+ _XML = u"""<?xml version="1.0"?><simple />"""
+
+ site = DummySite( 'site' ).__of__( self.root )
+ site.portal_setup = DummyTool( 'portal_setup' )
+ tool = site.portal_setup
+ ctx = self._makeOne( tool, 'simple' )
+
+ ctx.writeDataFile( _FILENAME, _XML, _CONTENT_TYPE )
+
+ snapshot = tool.snapshots._getOb( 'simple' )
+
+ self.assertEqual( len( snapshot.objectIds() ), 1 )
+ self.failUnless( _FILENAME in snapshot.objectIds() )
+
+ template = snapshot._getOb( _FILENAME )
+
+ self.assertEqual( template.getId(), _FILENAME )
+ self.assertEqual( template.meta_type, ZopePageTemplate.meta_type )
+ self.assertEqual( template.read(), _XML )
+ self.failIf( template.html() )
+
def test_writeDataFile_subdir_dtml( self ):
from OFS.DTMLDocument import DTMLDocument
=== CMF/CMFSetup/tests/test_tool.py 1.7 => 1.8 ===
--- CMF/CMFSetup/tests/test_tool.py:1.7 Mon May 24 10:36:50 2004
+++ CMF/CMFSetup/tests/test_tool.py Mon May 24 15:13:10 2004
@@ -522,6 +522,41 @@
self._verifyTarballEntry( fileish, 'properties.ini'
, _PROPERTIES_INI % site.title )
+ def test_createSnapshot_default( self ):
+
+ from test_registry import _EMPTY_IMPORT_XML
+
+ _EXPECTED = [ ( 'import_steps.xml', _EMPTY_IMPORT_XML )
+ , ( 'export_steps.xml'
+ , _DEFAULT_STEP_REGISTRIES_EXPORT_XML
+ )
+ ]
+
+ site = self._makeSite()
+ site.portal_setup = self._makeOne()
+ tool = site.portal_setup
+
+ result = tool.createSnapshot( 'default' )
+
+ self.assertEqual( len( result[ 'steps' ] ), 1 )
+ self.assertEqual( result[ 'steps' ][ 0 ], 'step_registries' )
+ self.assertEqual( result[ 'messages' ][ 'step_registries' ]
+ , 'Step registries exported'
+ )
+
+ snapshot = result[ 'snapshot' ]
+
+ self.assertEqual( len( snapshot.objectIds() ), len( _EXPECTED ) )
+
+ for id in [ x[0] for x in _EXPECTED ]:
+ self.failUnless( id in snapshot.objectIds() )
+
+ fileobj = snapshot._getOb( 'import_steps.xml' )
+ self.assertEqual( fileobj.read() , _EMPTY_IMPORT_XML )
+
+ fileobj = snapshot._getOb( 'export_steps.xml' )
+ self.assertEqual( fileobj.read() , _DEFAULT_STEP_REGISTRIES_EXPORT_XML )
+
_DEFAULT_STEP_REGISTRIES_EXPORT_XML = """\
<?xml version="1.0"?>
More information about the CMF-checkins
mailing list