Back to index

plone3  3.1.7
test_events.py
Go to the documentation of this file.
00001 import unittest
00002 from zope.interface.verify import verifyObject
00003 from Products.GenericSetup.events import BeforeProfileImportEvent
00004 from Products.GenericSetup.interfaces import IBeforeProfileImportEvent
00005 from Products.GenericSetup.events import ProfileImportedEvent
00006 from Products.GenericSetup.interfaces import IProfileImportedEvent
00007 
00008 class BaseEventTests(unittest.TestCase):
00009     def testInterface(self):
00010         event=self.klass("tool", "profile_id", "steps", "full_import")
00011         verifyObject(self.iface, event)
00012 
00013     def testNormalConstruction(self):
00014         event=self.klass("tool", "profile_id", "steps", "full_import")
00015         self.assertEqual(event.tool, "tool")
00016         self.assertEqual(event.profile_id, "profile_id")
00017         self.assertEqual(event.steps, "steps")
00018         self.assertEqual(event.full_import, "full_import")
00019 
00020     def testKeywordConstruction(self):
00021         event=self.klass(tool="tool", profile_id="profile_id", steps="steps", full_import="full_import")
00022         self.assertEqual(event.tool, "tool")
00023         self.assertEqual(event.profile_id, "profile_id")
00024         self.assertEqual(event.steps, "steps")
00025         self.assertEqual(event.full_import, "full_import")
00026 
00027 
00028 class BeforeProfileImportEventTests(BaseEventTests):
00029     klass = BeforeProfileImportEvent
00030     iface = IBeforeProfileImportEvent
00031 
00032 
00033 class ProfileImportedEventTests(BaseEventTests):
00034     klass = ProfileImportedEvent
00035     iface = IProfileImportedEvent
00036 
00037 
00038 def test_suite():
00039     suite = unittest.TestSuite()
00040     suite.addTest(unittest.makeSuite(BeforeProfileImportEventTests))
00041     suite.addTest(unittest.makeSuite(ProfileImportedEventTests))
00042     return suite
00043