aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/alert_new.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-06-26 18:18:56 +0100
committerMatthew Somerville <matthew@mysociety.org>2018-06-28 13:35:23 +0100
commitdadddc42f5e5c4b3a02db9171a485885b1e365a7 (patch)
tree603a745179c5b141211ccb6355fcbeaf7ecaeb95 /t/app/controller/alert_new.t
parent53f3af1fd561d852346902a06ef27c110d0bd2c1 (diff)
[UK] Fix issue when body ID not equal to MapIt ID.
Hitherto when creating a body or ward alert on a UK site, the MapIt area ID has been stored instead of the body ID. This is okay for www.fixmystreet.com which for historical reasons does have body IDs that match MapIt area IDs, but other UK-based sites may well not. The alert lookup looks for body ID, meaning those alerts will not work. Save the body ID instead, plus fix some tests that were making the same assumption.
Diffstat (limited to 't/app/controller/alert_new.t')
-rw-r--r--t/app/controller/alert_new.t24
1 files changed, 13 insertions, 11 deletions
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index 27371e4a9..49efc4efa 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -184,13 +184,15 @@ foreach my $test (
};
}
+my $body = $mech->create_body_ok(2651, 'Edinburgh Council');
+
foreach my $test (
{
desc => 'logged in user signing up',
email => 'test-sign-in@example.com',
type => 'council',
- param1 => 2651,
- param2 => 2651,
+ param1 => $body->id,
+ param2 => $body->id,
confirmed => 1,
}
)
@@ -207,9 +209,9 @@ foreach my $test (
ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
MAPIT_URL => 'http://mapit.uk/',
}, sub {
- $mech->get_ok('/alert/list?pc=EH991SP');
+ $mech->get_ok('/alert/list?pc=EH11BB');
};
- $mech->set_visible( [ radio => 'council:2651:City_of_Edinburgh' ] );
+ $mech->set_visible( [ radio => 'council:' . $body->id . ':City_of_Edinburgh' ] );
$mech->click('alert');
my $alert = FixMyStreet::App->model('DB::Alert')->find(
@@ -789,7 +791,7 @@ subtest "Test signature template is used from cobrand" => sub {
my $report_time = '2011-03-01 12:00:00';
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- bodies_str => '2651',
+ bodies_str => $body->id,
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Testing',
@@ -884,15 +886,15 @@ for my $test (
desc => 'check non public reports are not included in council problems alerts',
alert_params => {
alert_type => 'council_problems',
- parameter => '2651',
- parameter2 => '2651',
+ parameter => $body->id,
+ parameter2 => $body->id,
}
},
{
desc => 'check non public reports are not included in ward problems alerts',
alert_params => {
alert_type => 'ward_problems',
- parameter => '2651',
+ parameter => $body->id,
parameter2 => '20728',
}
},
@@ -936,7 +938,7 @@ for my $test (
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- bodies_str => '2651',
+ bodies_str => $body->id,
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Alert test for non public reports',
@@ -998,7 +1000,7 @@ subtest 'check new updates alerts for non public reports only go to report owner
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- bodies_str => '2651',
+ bodies_str => $body->id,
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Alert test for non public reports',
@@ -1091,7 +1093,7 @@ subtest 'check setting inlude dates in new updates cobrand option' => sub {
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- bodies_str => '2651',
+ bodies_str => $body->id,
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Alert test for non public reports',