aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/alert.t16
-rw-r--r--t/app/controller/alert_new.t27
2 files changed, 35 insertions, 8 deletions
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' } );