[Zope-Checkins] SVN: Zope/branches/gotcha-processlifetime/src/Zope2/App/tests/test_startup.py add tests for DatabaseOpened events
Godefroid Chapelle
gotcha at bubblenet.be
Sun Jun 27 06:29:01 EDT 2010
Log message for revision 113921:
add tests for DatabaseOpened events
Changed:
A Zope/branches/gotcha-processlifetime/src/Zope2/App/tests/test_startup.py
-=-
Added: Zope/branches/gotcha-processlifetime/src/Zope2/App/tests/test_startup.py
===================================================================
--- Zope/branches/gotcha-processlifetime/src/Zope2/App/tests/test_startup.py (rev 0)
+++ Zope/branches/gotcha-processlifetime/src/Zope2/App/tests/test_startup.py 2010-06-27 10:29:00 UTC (rev 113921)
@@ -0,0 +1,43 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import logging
+
+from Testing.ZopeTestCase import ZopeTestCase
+
+from zope.testing.loggingsupport import InstalledHandler
+
+logged = """Zope2.App.test_startup INFO
+ <class 'zope.processlifetime.DatabaseOpened'>
+Zope2.App.test_startup INFO
+ <class 'zope.processlifetime.DatabaseOpenedWithRoot'>"""
+
+
+def logevent(event):
+ logger = logging.getLogger('Zope2.App.test_startup')
+ logger.info(event.__class__)
+
+
+class StartupTests(ZopeTestCase):
+
+ def test_dummy(self):
+ from Zope2.App.startup import startup
+ from zope.component import provideHandler
+ from zope.processlifetime import IDatabaseOpened
+ from zope.processlifetime import IDatabaseOpenedWithRoot
+
+ handler = InstalledHandler('Zope2.App.test_startup')
+ provideHandler(logevent, [IDatabaseOpenedWithRoot])
+ provideHandler(logevent, [IDatabaseOpened])
+ startup()
+ self.assertEqual(str(handler), logged)
More information about the Zope-Checkins
mailing list