aboutsummaryrefslogtreecommitdiff
path: root/test/tc_mauve_notification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/tc_mauve_notification.rb')
-rw-r--r--test/tc_mauve_notification.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/tc_mauve_notification.rb b/test/tc_mauve_notification.rb
index 018c31a..4243874 100644
--- a/test/tc_mauve_notification.rb
+++ b/test/tc_mauve_notification.rb
@@ -100,7 +100,7 @@ class TcMauveDuringRunner < Mauve::UnitTest
def test_x_in_list_of_y
- mdr = Mauve::DuringRunner.new(Time.now)
+ dr = DuringRunner.new(Time.now)
[
[[0,1,3,4], 2, false],
[[0,2,4,6], 2, true],
@@ -108,14 +108,14 @@ class TcMauveDuringRunner < Mauve::UnitTest
[[0..2, 4,5],2, true],
[[0,1..3], 2, true],
].each do |y,x,result|
- assert_equal(result, mdr.send(:x_in_list_of_y, x,y))
+ assert_equal(result, dr.send(:x_in_list_of_y, x,y))
end
end
def test_hours_in_day
t = Time.gm(2010,1,2,3,4,5)
# => Sat Jan 02 03:04:05 UTC 2010
- mdr = Mauve::DuringRunner.new(t)
+ dr = DuringRunner.new(t)
[
[[0,1,3,4], true],
[[0,2,4,6], false],
@@ -126,14 +126,14 @@ class TcMauveDuringRunner < Mauve::UnitTest
[[0,1..3], true],
[[4..12], false]
].each do |hours, result|
- assert_equal(result, mdr.send(:hours_in_day, hours))
+ assert_equal(result, dr.send(:hours_in_day, hours))
end
end
def test_days_in_week
t = Time.gm(2010,1,2,3,4,5)
# => Sat Jan 02 03:04:05 UTC 2010
- mdr = Mauve::DuringRunner.new(t)
+ dr = DuringRunner.new(t)
[
[[0,1,3,4], false],
[[0,2,4,6], true],
@@ -144,11 +144,25 @@ class TcMauveDuringRunner < Mauve::UnitTest
[[0,1..3], false],
[[4..6], true]
].each do |days, result|
- assert_equal(result, mdr.send(:days_in_week, days), "#{t.wday} in #{days.join(", ")}")
+ assert_equal(result, dr.send(:days_in_week, days), "#{t.wday} in #{days.join(", ")}")
end
end
def test_unacknowledged
+ Server.instance.setup
+ alert = Alert.new(
+ :alert_id => "test",
+ :source => "test",
+ :subject => "test"
+ )
+ alert.raise!
+
+ Timecop.freeze(Time.now+1.hour)
+
+ dr = DuringRunner.new(Time.now, alert)
+
+ assert(!dr.send(:unacknowledged, 2.hours))
+ assert(dr.send(:unacknowledged, 1.hour))
end
end
@@ -300,4 +314,5 @@ EOF
end
+
end