aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-19 16:28:37 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-19 16:28:37 +0100
commitcdb78656916abe5adb946a25b913cda7785a42de (patch)
tree0f656d639868c2ac8d8a14a5370ab8f2263092dc /test
parent8d209c0f6a1b3c47f9bc55b6f63cb14bfa935162 (diff)
HTML now sanitised on save.
Added History tests Default polling interval now 5s, 0s for Timer/UDPServer Fixed note entry for alert page.
Diffstat (limited to 'test')
-rw-r--r--test/tc_mauve_alert.rb1
-rw-r--r--test/tc_mauve_alert_changed.rb15
-rw-r--r--test/tc_mauve_history.rb36
-rw-r--r--test/test_mauve.rb1
4 files changed, 53 insertions, 0 deletions
diff --git a/test/tc_mauve_alert.rb b/test/tc_mauve_alert.rb
index 738489d..f85236e 100644
--- a/test/tc_mauve_alert.rb
+++ b/test/tc_mauve_alert.rb
@@ -42,6 +42,7 @@ EOF
end
+
#
# This is also the test for in_source_list?
#
diff --git a/test/tc_mauve_alert_changed.rb b/test/tc_mauve_alert_changed.rb
index 52f1f25..0e57120 100644
--- a/test/tc_mauve_alert_changed.rb
+++ b/test/tc_mauve_alert_changed.rb
@@ -67,6 +67,21 @@ EOF
AlertChanged.all.each{|ac| ac.poll}
end
+ # OK now clear the alert, send one notification and set an alert_changed.
+ alert.clear!
+ notifications += 1
+ reminders += 1
+ assert_equal(notifications, Server.instance.notification_buffer.length)
+ assert_equal(reminders, AlertChanged.count)
+
+ Timecop.freeze(Time.now + 10.minutes)
+ AlertChanged.all.each{|ac| ac.poll}
+ #
+ # Send NO MORE notifications.
+ #
+ assert_equal(notifications, Server.instance.notification_buffer.length)
+ assert_equal(reminders, AlertChanged.count)
+
end
diff --git a/test/tc_mauve_history.rb b/test/tc_mauve_history.rb
new file mode 100644
index 0000000..62342f2
--- /dev/null
+++ b/test/tc_mauve_history.rb
@@ -0,0 +1,36 @@
+$:.unshift "../lib"
+
+require 'th_mauve'
+require 'mauve/history'
+require 'mauve/server'
+
+class TcMauveHistory < Mauve::UnitTest
+
+ include Mauve
+
+ def setup
+ super
+ setup_database
+ end
+
+ def teardown
+ teardown_database
+ super
+ end
+
+ def test_save
+ Server.instance.setup
+ #
+ # Make sure events save without nasty html
+ #
+ h = History.new(:alerts => [], :type => "note", :event => "Hello <script>alert(\"arse\");</script>")
+
+ h.save
+ h.reload
+ assert_equal("Hello ",h.event, "HTML not stripped correctly on save.")
+ end
+end
+
+
+
+
diff --git a/test/test_mauve.rb b/test/test_mauve.rb
index 87aa188..fba47eb 100644
--- a/test/test_mauve.rb
+++ b/test/test_mauve.rb
@@ -18,6 +18,7 @@ tc_mauve_source_list.rb
tc_mauve_people_list.rb
tc_mauve_person.rb
tc_mauve_alert.rb
+tc_mauve_history.rb
tc_mauve_alert_group.rb
tc_mauve_alert_changed.rb
tc_mauve_notification.rb