diff options
author | louise <louise> | 2009-09-28 15:38:30 +0000 |
---|---|---|
committer | louise <louise> | 2009-09-28 15:38:30 +0000 |
commit | 80b25ba3f05df9a8cdb6887472566ccefea7eb45 (patch) | |
tree | 1634171916e9e4adaa1c8e2ec1fc0af91cc57173 /t | |
parent | 248b73263e20aa4839fd172a696fff3590f898d7 (diff) |
Allow extra data to be saved with alerts
Diffstat (limited to 't')
-rwxr-xr-x | t/Cobrand.t | 20 | ||||
-rw-r--r-- | t/Cobrands/Mysite/Util.pm | 6 |
2 files changed, 23 insertions, 3 deletions
diff --git a/t/Cobrand.t b/t/Cobrand.t index f0f1751a0..933a03cfa 100755 --- a/t/Cobrand.t +++ b/t/Cobrand.t @@ -6,12 +6,12 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: louise@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Cobrand.t,v 1.13 2009-09-23 17:01:00 louise Exp $ +# $Id: Cobrand.t,v 1.14 2009-09-28 15:38:30 louise Exp $ # use strict; use warnings; -use Test::More tests => 41; +use Test::More tests => 44; use Test::Exception; use FindBin; @@ -107,6 +107,21 @@ sub test_extra_update_data { ok($cobrand_data eq '', 'extra_update_data should return an empty string if there is no cobrand module') or diag("Got $cobrand_data"); } + +sub test_extra_alert_data { + my $cobrand = 'mysite'; + my $q = new MockQuery($cobrand); + + # should get the result of the page function in the cobrand module if one exists + my $cobrand_data = Cobrand::extra_alert_data($cobrand, $q); + ok($cobrand_data eq 'Cobrand alert data', 'extra_alert_data should return data from cobrand module') or diag("Got $cobrand_data"); + + # should return an empty string if no cobrand module exists + $q = new MockQuery('nosite'); + $cobrand_data = Cobrand::extra_alert_data('nosite', $q); + ok($cobrand_data eq '', 'extra_alert_data should return an empty string if there is no cobrand module') or diag("Got $cobrand_data"); +} + sub test_base_url { my $cobrand = 'mysite'; @@ -199,6 +214,7 @@ ok(test_form_elements() == 1, 'Ran all tests for form_elements'); ok(test_base_url_for_emails() == 1, 'Ran all tests for base_url_for_emails'); ok(test_extra_problem_data() == 1, 'Ran all tests for extra_problem_data'); ok(test_extra_update_data() == 1, 'Ran all tests for extra_update_data'); +ok(test_extra_alert_data() == 1, 'Ran all tests for extra_alert_data'); ok(test_extra_params() == 1, 'Ran all tests for extra_params'); ok(test_header_params() == 1, 'Ran all tests for header_params'); ok(test_root_path_js() == 1, 'Ran all tests for root_js'); diff --git a/t/Cobrands/Mysite/Util.pm b/t/Cobrands/Mysite/Util.pm index 370e9d700..36b04f596 100644 --- a/t/Cobrands/Mysite/Util.pm +++ b/t/Cobrands/Mysite/Util.pm @@ -7,7 +7,7 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: louise@mysociety.org. WWW: http://www.mysociety.org # -# $Id: Util.pm,v 1.12 2009-09-23 17:01:00 louise Exp $ +# $Id: Util.pm,v 1.13 2009-09-28 15:39:05 louise Exp $ package Cobrands::Mysite::Util; use Page; @@ -57,6 +57,10 @@ sub extra_update_data { return "Cobrand update data"; } +sub extra_alert_data { + return "Cobrand alert data"; +} + sub extra_params { return 'key=value'; } |