aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Mock/MapIt.pm1
-rw-r--r--t/app/controller/report_inspect.t23
2 files changed, 19 insertions, 5 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index dc23b9ae2..0b9d398e8 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -32,6 +32,7 @@ my @PLACES = (
[ 'GL50 2PR', 51.896268, -2.093063, 2226, 'Gloucestershire County Council', 'CTY', 2326, 'Cheltenham Borough Council', 'DIS', 4544, 'Lansdown', 'DIW', 143641, 'Lansdown and Park', 'CED' ],
[ '?', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],
[ 'OX20 1SZ', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],
+ [ 'OX16 9UP', 52.038712, -1.346397, 2237, 'Oxfordshire County Council', 'CTY', 2419, 'Cherwell District Council', 'DIS', 151767, "Banbury, Calthorpe & Easington", "DIW" ],
[ 'BR1 3UH', 51.4021, 0.01578, 2482, 'Bromley Council', 'LBO' ],
[ 'BR1 3UH', 51.402096, 0.015784, 2482, 'Bromley Council', 'LBO' ],
[ '?', 50.78301, -0.646929 ],
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 6e65c1336..e3ca33f0f 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -32,14 +32,14 @@ FixMyStreet::DB->resultset("ContactResponsePriority")->create({
contact => $contact3,
response_priority => $rp2,
});
-my $wodc = $mech->create_body_ok(2420, 'West Oxfordshire District Council');
-$mech->create_contact_ok( body_id => $wodc->id, category => 'Horses', email => 'horses@example.net' );
+my $oxfordcity = $mech->create_body_ok(2421, 'Oxford City Council');
+$mech->create_contact_ok( body_id => $oxfordcity->id, category => 'Horses', email => 'horses@example.net' );
my ($report, $report2, $report3) = $mech->create_problems_for_body(3, $oxon->id, 'Test', {
- category => 'Cows', cobrand => 'fixmystreet', areas => ',2237,2420',
+ category => 'Cows', cobrand => 'fixmystreet', areas => ',2237,2421,',
whensent => \'current_timestamp',
- latitude => 51.847693, longitude => -1.355908,
+ latitude => 51.754926, longitude => -1.256179,
});
my $report_id = $report->id;
my $report2_id = $report2->id;
@@ -153,6 +153,19 @@ FixMyStreet::override_config {
$mech->content_lacks('Invalid location');
};
+ subtest "test areas update when location changes" => sub {
+ $report->discard_changes;
+ my ($lat, $lon, $areas) = ($report->latitude, $report->longitude, $report->areas);
+ $mech->get_ok("/report/$report_id");
+ $mech->submit_form_ok({ button => 'save', with_fields => { latitude => 52.038712, longitude => -1.346397, include_update => undef } });
+ $mech->content_lacks('Invalid location');
+ $report->discard_changes;
+ is $report->areas, ",151767,2237,2419,", 'Areas set correctly';
+ $mech->submit_form_ok({ button => 'save', with_fields => { latitude => $lat, longitude => $lon, include_update => undef } });
+ $report->discard_changes;
+ is $report->areas, $areas, 'Areas reset correctly';
+ };
+
subtest "test duplicate reports are shown" => sub {
my $old_state = $report->state;
$report->set_extra_metadata('duplicate_of' => $report2->id);
@@ -761,7 +774,7 @@ FixMyStreet::override_config {
$report->discard_changes;
is $report->category, "Horses", "Report in correct category";
is $report->whensent, undef, "Report marked as unsent";
- is $report->bodies_str, $wodc->id, "Reported to WODC";
+ is $report->bodies_str, $oxfordcity->id, "Reported to Oxford City";
is $mech->uri->path, "/report/$report_id", "redirected to correct page";
is $mech->res->code, 200, "got 200 for final destination";