diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/tc_mauve_alert.rb | 1 | ||||
-rw-r--r-- | test/tc_mauve_alert_changed.rb | 15 | ||||
-rw-r--r-- | test/tc_mauve_history.rb | 36 | ||||
-rw-r--r-- | test/test_mauve.rb | 1 |
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 |