Back to index

plone3  3.1.7
test_exportimport.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """PageTemplate export / import support unit tests.
00014 
00015 $Id: test_exportimport.py 71212 2006-11-20 19:27:48Z yuppie $
00016 """
00017 
00018 import unittest
00019 import Testing
00020 
00021 from Products.GenericSetup.testing import BodyAdapterTestCase
00022 from Products.GenericSetup.testing import ExportImportZCMLLayer
00023 
00024 _PAGETEMPLATE_BODY = """\
00025 <html>
00026   <div>Foo</div>
00027 </html>
00028 """
00029 
00030 
00031 class ZopePageTemplateBodyAdapterTests(BodyAdapterTestCase):
00032 
00033     layer = ExportImportZCMLLayer
00034 
00035     def _getTargetClass(self):
00036         from Products.GenericSetup.PageTemplates.exportimport \
00037                 import ZopePageTemplateBodyAdapter
00038 
00039         return ZopePageTemplateBodyAdapter
00040 
00041     def _populate(self, obj):
00042         obj.write(_PAGETEMPLATE_BODY)
00043 
00044     def setUp(self):
00045         from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
00046 
00047         BodyAdapterTestCase.setUp(self)
00048         self._obj = ZopePageTemplate('foo_template')
00049         self._BODY = _PAGETEMPLATE_BODY
00050 
00051 
00052 def test_suite():
00053     return unittest.TestSuite((
00054         unittest.makeSuite(ZopePageTemplateBodyAdapterTests),
00055         ))
00056 
00057 if __name__ == '__main__':
00058     from Products.GenericSetup.testing import run
00059     run(test_suite())