From 89c47f0aa9acaf5ed9b361e4e9efbbd7e3da8efc Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 20 Apr 2012 14:56:17 +0100 Subject: Updated tests to use coupled processor/notifier. --- test/tc_mauve_alert_changed.rb | 27 ++++++++++++--------------- test/tc_mauve_notification.rb | 30 ++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/tc_mauve_alert_changed.rb b/test/tc_mauve_alert_changed.rb index 167ea75..6cd51fb 100644 --- a/test/tc_mauve_alert_changed.rb +++ b/test/tc_mauve_alert_changed.rb @@ -24,6 +24,10 @@ class TcMauveAlertChanged < Mauve::UnitTest def test_reminder config=< "test", :alert_id => "test_alert", :summary => "test alert") alert.raise! - assert_nothing_raised{ Notifier.instance.__send__(:main_loop) } assert_equal(1, notification_buffer.length, "Wrong no of notifications sent after raise.") assert_equal(1, AlertChanged.count, "Wrong no of AlertChangeds created after raise.") alert.acknowledge!(Configuration.current.people["test_person"], Time.now + 10.minutes) - assert_nothing_raised{ Notifier.instance.__send__(:main_loop) } assert_equal(2, notification_buffer.length, "Wrong no of notifications sent after raise.") assert_equal(2, AlertChanged.count, "Wrong no of AlertChangeds created after acknowledge.") @@ -145,7 +143,6 @@ EOF # Timecop.freeze(Time.now + 10.minutes) AlertChanged.all.each{|ac| ac.poll} - assert_nothing_raised{ Notifier.instance.__send__(:main_loop) } assert_equal(2, notification_buffer.length, "Extra notifications sent when alertchangeds are polled.") # @@ -154,19 +151,21 @@ EOF alert.poll assert(!alert.acknowledged?,"Alert not unacknowledged") assert(alert.raised?,"Alert not raised following unacknowledgment") - assert_nothing_raised{ Notifier.instance.__send__(:main_loop) } assert_equal(3, notification_buffer.length, "No re-raise notification sent.") # # If we poll the AlertChangeds again, no further notification should be sent. # AlertChanged.all.each{|ac| ac.poll} - assert_nothing_raised{ Notifier.instance.__send__(:main_loop) } assert_equal(3, notification_buffer.length, "Extra notifications sent when alertchangeds are polled.") end def test_only_set_one_alert_changed_on_a_reminder_after_multiple_raises_and_clears config=<