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 """PythonScript 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 _PYTHONSCRIPT_BODY = """\
00025 ## Script (Python) "foo_script"
00026 ##bind container=container
00027 ##bind context=context
00028 ##bind namespace=
00029 ##bind script=script
00030 ##bind subpath=traverse_subpath
00031 ##parameters=
00032 ##title=
00033 ##
00034 """
00035 
00036 
00037 class PythonScriptBodyAdapterTests(BodyAdapterTestCase):
00038 
00039     layer = ExportImportZCMLLayer
00040 
00041     def _getTargetClass(self):
00042         from Products.GenericSetup.PythonScripts.exportimport \
00043                 import PythonScriptBodyAdapter
00044 
00045         return PythonScriptBodyAdapter
00046 
00047     def setUp(self):
00048         from Products.PythonScripts.PythonScript import PythonScript
00049 
00050         BodyAdapterTestCase.setUp(self)
00051         self._obj = PythonScript('foo_script')
00052         self._BODY = _PYTHONSCRIPT_BODY
00053 
00054 
00055 def test_suite():
00056     return unittest.TestSuite((
00057         unittest.makeSuite(PythonScriptBodyAdapterTests),
00058         ))
00059 
00060 if __name__ == '__main__':
00061     from Products.GenericSetup.testing import run
00062     run(test_suite())