diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-08-17 16:49:50 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-08-17 18:23:54 +0100 |
commit | fe418a281d1960c128171073b3f77a0599c4f4f1 (patch) | |
tree | 73561ef606627c01e22188d0a163f7d7d381b4f3 | |
parent | f87b0e3e9c3ca1f67f4ecbff9065f2eeed1e81e9 (diff) |
[Buckinghamshire] Fix off-road reports on .com.
Off-road flytipping reports were not being categorised on .com
like they were on the Buckinghamshire cobrand.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 9 | ||||
-rw-r--r-- | t/cobrand/bucks.t | 22 |
2 files changed, 29 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index f39558f45..ca041bf70 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -347,4 +347,13 @@ sub manifest { }; } +sub report_new_munge_before_insert { + my ($self, $report) = @_; + + # Make sure TfL reports are marked safety critical + $self->SUPER::report_new_munge_before_insert($report); + + FixMyStreet::Cobrand::Buckinghamshire::report_new_munge_before_insert($self, $report); +} + 1; diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t index 36e149a13..8d99178f5 100644 --- a/t/cobrand/bucks.t +++ b/t/cobrand/bucks.t @@ -130,6 +130,24 @@ subtest 'Flytipping not on a road gets recategorised' => sub { is $report->category, "Flytipping (off-road)", 'Report was recategorised correctly'; }; +subtest 'Flytipping not on a road on .com gets recategorised' => sub { + ok $mech->host("www.fixmystreet.com"), "change host to www"; + $mech->get_ok('/report/new?latitude=51.615559&longitude=-0.556903&category=Flytipping'); + $mech->submit_form_ok({ + with_fields => { + title => "Test Report", + detail => 'Test report details.', + category => 'Flytipping', + 'road-placement' => 'off-road', + } + }, "submit details"); + $mech->content_contains('on its way to the council right now'); + 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'; + ok $mech->host("buckinghamshire.fixmystreet.com"), "change host to bucks"; +}; + 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({ @@ -151,7 +169,7 @@ subtest 'Flytipping not on a road going to HE does not get recategorised' => sub subtest 'Ex-district reports are sent to correct emails' => sub { FixMyStreet::Script::Reports::send(); - $mech->email_count_is(2); # one for council, one confirmation for user + $mech->email_count_is(4); # (one for council, one confirmation for user) x 2 my @email = $mech->get_email; is $email[0]->header('To'), 'Buckinghamshire <flytipping@chiltern>'; }; @@ -245,7 +263,7 @@ subtest 'extra CSV columns are present' => sub { $mech->get_ok('/dashboard?export=1'); my @rows = $mech->content_as_csv; - is scalar @rows, 5, '1 (header) + 4 (reports) = 5 lines'; + is scalar @rows, 6, '1 (header) + 4 (reports) = 6 lines'; is scalar @{$rows[0]}, 21, '21 columns present'; is_deeply $rows[0], |