changeset 534:79dd34e914a7

Merge `BittenNotify` and `BittenNotifyDispatcher` into one component
author mgood
date Mon, 23 Mar 2009 00:07:43 +0000
parents 7c1919719538
children 6a2dc6cdc4dd
files bitten/notify.py bitten/tests/notify.py
diffstat 2 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/notify.py
+++ b/bitten/notify.py
@@ -20,6 +20,9 @@
 
 
 class BittenNotify(Component):
+    """Sends notifications on build status by mail."""
+    implements(IBuildListener, ITemplateProvider)
+
     notify_on_failure = BoolOption(CONFIG_SECTION, NOTIFY_ON_FAILURE, 'true',
             """Notify if bitten build fails.""")
 
@@ -28,15 +31,6 @@
 
     def __init__(self):
         self.log.debug('Initializing BittenNotify plugin')
-
-
-class BittenNotifyDispatcher(Component):
-    """Sends notifications on build status by mail."""
-
-    implements(IBuildListener, ITemplateProvider)
-
-    def __init__(self):
-        self.log.debug('Initializing BittenNotify Dispatcher')
         self.email = BittenNotifyEmail(self.env)
 
     def notify(self, build = None):
--- a/bitten/tests/notify.py
+++ b/bitten/tests/notify.py
@@ -37,7 +37,7 @@
                 cursor.execute(stmt)
         db.commit()
 
-class BittenNotifyDispatcherTest(BittenNotifyBaseTest):
+class BittenNotifyTest(BittenNotifyBaseTest):
     """unit tests for BittenNotify dispatcher class"""
     def setUp(self):
         BittenNotifyBaseTest.setUp(self)
@@ -45,7 +45,7 @@
         self.state = [False]
         self.email = Mock(notify = lambda buildInfo: \
                 self.state.__setitem__(0,True))
-        self.dispatcher = BittenNotifyDispatcher(self.env)
+        self.dispatcher = BittenNotify(self.env)
         self.dispatcher.email = self.email
         self.failed_build = Build(self.env, status = Build.FAILURE)
         self.successful_build = Build(self.env, status = Build.SUCCESS)
@@ -161,7 +161,7 @@
 
 def suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(BittenNotifyDispatcherTest,'test'))
+    suite.addTest(unittest.makeSuite(BittenNotifyTest,'test'))
     suite.addTest(unittest.makeSuite(BuildInfoTest,'test'))
     suite.addTest(unittest.makeSuite(BittenNotifyEmailTest,'test'))
     return suite
Copyright (C) 2012-2017 Edgewall Software