diff options
author | Marius Halden <marius.h@lden.org> | 2021-10-07 13:32:40 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2021-10-07 13:32:40 +0200 |
commit | 09dacfc6b8bf62addeee16c20b1d90c2a256da96 (patch) | |
tree | 7caa2bf9e92227ab74448f9b746dd28bbcb81b2a /t/cobrand/bucks.t | |
parent | 585e57484f9c6332668bf1ac0a6a3b39dbe32223 (diff) | |
parent | cea89fb87a96943708a1db0f646492fbfaaf000f (diff) |
Merge tag 'v3.1' into fiksgatami-devfiksgatami-dev
Diffstat (limited to 't/cobrand/bucks.t')
-rw-r--r-- | t/cobrand/bucks.t | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t index 230a52f99..8d99178f5 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,13 +128,48 @@ 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 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({ + 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; }; 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>'; }; @@ -229,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], |