示例#1
0
class BittenNotifyTest(BittenNotifyBaseTest):
    """unit tests for BittenNotify dispatcher class"""
    def setUp(self):
        BittenNotifyBaseTest.setUp(self)
        self.dispatcher = BittenNotify(self.env)
        self.failed_build = Build(self.env, status=Build.FAILURE)
        self.successful_build = Build(self.env, status=Build.SUCCESS)

    def test_do_notify_on_failed_build(self):
        self.set_option(BittenNotify.notify_on_failure, 'true')
        self.assertTrue(self.dispatcher._should_notify(self.failed_build),
                'notifier should be called for failed builds.')

    def test_do_not_notify_on_failed_build(self):
        self.set_option(BittenNotify.notify_on_failure, 'false')
        self.assertFalse(self.dispatcher._should_notify(self.failed_build),
                'notifier should not be called for failed build.')

    def test_do_notify_on_successful_build(self):
        self.set_option(BittenNotify.notify_on_success, 'true')
        self.assertTrue(self.dispatcher._should_notify(self.successful_build),
                'notifier should be called for successful builds when configured.')

    def test_do_not_notify_on_successful_build(self):
        self.set_option(BittenNotify.notify_on_success, 'false')
        self.assertFalse(self.dispatcher._should_notify(self.successful_build),
                'notifier should not be called for successful build.')

    def set_option(self, option, value):
        self.env.config.set(option.section, option.name, value)
示例#2
0
class BittenNotifyTest(BittenNotifyBaseTest):
    """unit tests for BittenNotify dispatcher class"""
    def setUp(self):
        BittenNotifyBaseTest.setUp(self)
        self.dispatcher = BittenNotify(self.env)
        self.failed_build = Build(self.env, status=Build.FAILURE)
        self.successful_build = Build(self.env, status=Build.SUCCESS)

    def test_do_notify_on_failed_build(self):
        self.set_option(BittenNotify.notify_on_failure, 'true')
        self.assertTrue(self.dispatcher._should_notify(self.failed_build),
                        'notifier should be called for failed builds.')

    def test_do_not_notify_on_failed_build(self):
        self.set_option(BittenNotify.notify_on_failure, 'false')
        self.assertFalse(self.dispatcher._should_notify(self.failed_build),
                         'notifier should not be called for failed build.')

    def test_do_notify_on_successful_build(self):
        self.set_option(BittenNotify.notify_on_success, 'true')
        self.assertTrue(
            self.dispatcher._should_notify(self.successful_build),
            'notifier should be called for successful builds when configured.')

    def test_do_not_notify_on_successful_build(self):
        self.set_option(BittenNotify.notify_on_success, 'false')
        self.assertFalse(
            self.dispatcher._should_notify(self.successful_build),
            'notifier should not be called for successful build.')

    def set_option(self, option, value):
        self.env.config.set(option.section, option.name, value)
示例#3
0
 def setUp(self):
     BittenNotifyBaseTest.setUp(self)
     self.dispatcher = BittenNotify(self.env)
     self.failed_build = Build(self.env, status=Build.FAILURE)
     self.successful_build = Build(self.env, status=Build.SUCCESS)
示例#4
0
 def setUp(self):
     BittenNotifyBaseTest.setUp(self)
     self.dispatcher = BittenNotify(self.env)
     self.failed_build = Build(self.env, status=Build.FAILURE)
     self.successful_build = Build(self.env, status=Build.SUCCESS)