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 """OFSP 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 _FOLDER_BODY = """\
00025 <?xml version="1.0"?>
00026 <object name="foo_folder" meta_type="Folder">
00027  <property name="title">Foo</property>
00028 </object>
00029 """
00030 
00031 
00032 class FolderXMLAdapterTests(BodyAdapterTestCase):
00033 
00034     layer = ExportImportZCMLLayer
00035 
00036     def _getTargetClass(self):
00037         from Products.GenericSetup.OFSP.exportimport import FolderXMLAdapter
00038 
00039         return FolderXMLAdapter
00040 
00041     def _populate(self, obj):
00042         obj._setPropValue('title', 'Foo')
00043 
00044     def _verifyImport(self, obj):
00045         self.assertEqual(type(obj.title), str)
00046         self.assertEqual(obj.title, 'Foo')
00047 
00048     def setUp(self):
00049         from OFS.Folder import Folder
00050 
00051         BodyAdapterTestCase.setUp(self)
00052         self._obj = Folder('foo_folder')
00053         self._BODY = _FOLDER_BODY
00054 
00055 
00056 def test_suite():
00057     return unittest.TestSuite((
00058         unittest.makeSuite(FolderXMLAdapterTests),
00059         ))
00060 
00061 if __name__ == '__main__':
00062     from Products.GenericSetup.testing import run
00063     run(test_suite())