From cdb78656916abe5adb946a25b913cda7785a42de Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 19 Aug 2011 16:28:37 +0100 Subject: HTML now sanitised on save. Added History tests Default polling interval now 5s, 0s for Timer/UDPServer Fixed note entry for alert page. --- test/tc_mauve_alert.rb | 1 + test/tc_mauve_alert_changed.rb | 15 +++++++++++++++ test/tc_mauve_history.rb | 36 ++++++++++++++++++++++++++++++++++++ test/test_mauve.rb | 1 + 4 files changed, 53 insertions(+) create mode 100644 test/tc_mauve_history.rb (limited to 'test') 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 ") + + 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 -- cgit v1.2.3