diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-07-02 14:03:06 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-07-08 07:46:23 +0100 |
commit | 94d6eb5e670e29bfca4c81c18ec94e79b6cfafd7 (patch) | |
tree | e9713a08c0ad9e2f0a5ce09ab708c90e6b2a075f | |
parent | ee0d396b21045ddc8daf16a339f0eef8fe3c555f (diff) |
[Buckinghamshire] Handle HE flytipping reports.
We do not want to recategorise a report into the off-road
category if it is going to be sent to Highways England.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Buckinghamshire.pm | 1 | ||||
-rw-r--r-- | t/cobrand/bucks.t | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm index 117725273..bd20d77ff 100644 --- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm +++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm @@ -103,6 +103,7 @@ sub report_new_munge_before_insert { my ($self, $report) = @_; return unless $report->category eq 'Flytipping'; + return unless $self->{c}->stash->{report}->to_body_named('Buckinghamshire'); my $placement = $self->{c}->get_param('road-placement'); return unless $placement && $placement eq 'off-road'; diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t index 230a52f99..36e149a13 100644 --- a/t/cobrand/bucks.t +++ b/t/cobrand/bucks.t @@ -112,7 +112,6 @@ subtest 'pothole on road not sent to extra email, only confirm sent' => sub { is $report->external_id, 248, 'Report has right external ID'; }; - # report made in Flytipping category off road should get moved to other category subtest 'Flytipping not on a road gets recategorised' => sub { $mech->log_in_ok($publicuser->email); @@ -129,6 +128,23 @@ subtest 'Flytipping not on a road gets recategorised' => sub { my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first; ok $report, "Found the report"; is $report->category, "Flytipping (off-road)", 'Report was recategorised correctly'; +}; + +subtest 'Flytipping not on a road going to HE does not get recategorised' => sub { + $mech->get_ok('/report/new?latitude=51.615559&longitude=-0.556903&category=Flytipping'); + $mech->submit_form_ok({ + with_fields => { + single_body_only => 'Highways England', + title => "Test Report", + detail => 'Test report details.', + category => 'Flytipping', + 'road-placement' => 'off-road', + } + }, "submit details"); + $mech->content_contains('We don’t handle this type of problem'); + my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first; + ok $report, "Found the report"; + is $report->category, "Flytipping", 'Report was not recategorised'; $mech->log_out_ok; }; |