diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/Cobrand.t | 18 | ||||
-rw-r--r-- | t/Cobrands/Mysite/Util.pm | 4 | ||||
-rw-r--r-- | t/app/controller/alert.t | 16 | ||||
-rw-r--r-- | t/app/controller/alert_new.t | 27 |
4 files changed, 36 insertions, 29 deletions
diff --git a/t/Cobrand.t b/t/Cobrand.t index 1f38ec605..d3857e523 100755 --- a/t/Cobrand.t +++ b/t/Cobrand.t @@ -11,7 +11,7 @@ use strict; use warnings; -use Test::More tests => 59; +use Test::More tests => 56; use Test::Exception; use Error qw(:try); @@ -135,21 +135,6 @@ sub test_base_url_for_emails { } -sub test_extra_params { - my $cobrand = 'mysite'; - my $q = new MockQuery($cobrand); - - # should get the results of the extra_params function in the cobrand module if one exists - my $extra_params = Cobrand::extra_params($cobrand, $q); - is($extra_params, 'key=value', 'extra_params returns output from cobrand module') ; - - # should return an empty string otherwise - $cobrand = 'nosite'; - $extra_params = Cobrand::extra_params($cobrand, $q); - is($extra_params, '', 'extra_params returns an empty string if no cobrand module'); - -} - sub test_header_params { my $cobrand = 'mysite'; my $q = new MockQuery($cobrand); @@ -270,7 +255,6 @@ 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'); ok(test_site_title() == 1, 'Ran all tests for site_title'); diff --git a/t/Cobrands/Mysite/Util.pm b/t/Cobrands/Mysite/Util.pm index c1a8023c1..65591528f 100644 --- a/t/Cobrands/Mysite/Util.pm +++ b/t/Cobrands/Mysite/Util.pm @@ -61,10 +61,6 @@ sub extra_alert_data { return "Cobrand alert data"; } -sub extra_params { - return 'key=value'; -} - sub header_params { my %params = ('key' => 'value'); return \%params; diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t index 3e2dedd53..b8e38ec92 100644 --- a/t/app/controller/alert.t +++ b/t/app/controller/alert.t @@ -51,16 +51,16 @@ $mech->content_contains('Please select the feed you want'); $mech->get_ok('/alert/subscribe?rss=1&feed=invalid:1000:A_Locationtype=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy='); $mech->content_contains('Illegal feed selection'); -$mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:A_Location'); -$mech->uri->path('/rss/area/A+Location'); +$mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:Birmingham'); +is $mech->uri->path, '/rss/reports/Birmingham'; -$mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:1001:A_Location:Diff_Location'); -$mech->uri->path('/rss/area/A+Location/Diff+Location'); +$mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:1001:Cheltenham:Lansdown'); +is $mech->uri->path, '/rss/area/Cheltenham/Lansdown'; -$mech->get_ok('/alert/subscribe?rss=1&feed=council:1000:A_Location'); -$mech->uri->path('/rss/reports/A+Location'); +$mech->get_ok('/alert/subscribe?rss=1&feed=council:1000:Gloucestershire'); +is $mech->uri->path, '/rss/reports/Gloucestershire'; -$mech->get_ok('/alert/subscribe?rss=1&feed=ward:1000:1001:A_Location:Diff_Location'); -$mech->uri->path('/rss/ward/A+Location/Diff+Location'); +$mech->get_ok('/alert/subscribe?rss=1&feed=ward:1000:1001:Cheltenham:Lansdown'); +is $mech->uri->path, '/rss/reports/Cheltenham/Lansdown'; done_testing(); diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index ff1acd480..6fc32acbf 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -347,6 +347,33 @@ for my $test ( }; } +subtest "Test two-tier council alerts" => sub { + for my $alert ( + { feed => "local:51.896269:-2.093063", result => '/rss/l/51.896269,-2.093063' }, + { feed => "area:2326:Cheltenham", result => '/rss/area/Cheltenham' }, + { feed => "area:2326:4544:Cheltenham:Lansdown", result => '/rss/area/Cheltenham/Lansdown' }, + { feed => "area:2226:Gloucestershire", result => '/rss/area/Gloucestershire' }, + { feed => "area:2226:14949:Gloucestershire:Lansdown%2C_Park_and_Warden_Hill", + result => '/rss/area/Gloucestershire/Lansdown%2C+Park+and+Warden+Hill' + }, + { feed => "council:2326:Cheltenham", result => '/rss/reports/Cheltenham' }, + { feed => "ward:2326:4544:Cheltenham:Lansdown", result => '/rss/reports/Cheltenham/Lansdown' }, + { feed => "council:2226:Gloucestershire", result => '/rss/reports/Gloucestershire' }, + { feed => "ward:2226:14949:Gloucestershire:Lansdown%2C_Park_and_Warden_Hill", + result => '/rss/reports/Gloucestershire/Lansdown%2C+Park+and+Warden+Hill' + }, + ) { + $mech->get_ok( '/alert/list?pc=GL502PR' ); + $mech->submit_form_ok( { + button => 'rss', + with_fields => { + feed => $alert->{feed}, + } + } ); + is $mech->uri->path, $alert->{result}; + } +}; + subtest "Test normal alert signups and that alerts are sent" => sub { my $user1 = FixMyStreet::App->model('DB::User') ->find_or_create( { email => 'reporter@example.com', name => 'Reporter User' } ); |