diff options
author | Dave Arter <davea@mysociety.org> | 2019-03-07 10:43:32 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-03-20 09:47:02 +0000 |
commit | 0358523592d75cd274b9675fddd3752fc0a5847b (patch) | |
tree | e87defb62875b796f713a2344a8b5127ff837186 /t | |
parent | 4c1a483e4baa821c7d7b75e1bcef293ab13919ed (diff) |
[Buckinghamshire] Send drainage reports via email as well as Open311
Fixes mysociety/fixmystreet-commercial#1306
Diffstat (limited to 't')
-rw-r--r-- | t/cobrand/bucks.t | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t index ba0a20ba9..74684c27e 100644 --- a/t/cobrand/bucks.t +++ b/t/cobrand/bucks.t @@ -10,6 +10,7 @@ my $counciluser = $mech->create_user_ok('counciluser@example.com', name => 'Coun $mech->create_contact_ok(body_id => $body->id, category => 'Flytipping', email => "FLY"); $mech->create_contact_ok(body_id => $body->id, category => 'Potholes', email => "POT"); +$mech->create_contact_ok(body_id => $body->id, category => 'Blocked drain', email => "DRA"); my $district = $mech->create_body_ok(2257, 'Chiltern'); $mech->create_contact_ok(body_id => $district->id, category => 'Flytipping', email => "flytipping\@chiltern"); @@ -37,6 +38,7 @@ subtest 'cobrand displays correct categories' => sub { my $json = $mech->get_ok_json('/report/new/ajax?latitude=51.615559&longitude=-0.556903'); is @{$json->{bodies}}, 2, 'Both Chiltern and Bucks returned'; like $json->{category}, qr/Flytipping/, 'Flytipping displayed'; + like $json->{category}, qr/Blocked drain/, 'Blocked drain displayed'; unlike $json->{category}, qr/Graffiti/, 'Graffiti not displayed'; $json = $mech->get_ok_json('/report/new/category_extras?latitude=51.615559&longitude=-0.556903'); is @{$json->{bodies}}, 2, 'Still both Chiltern and Bucks returned'; @@ -85,6 +87,19 @@ subtest 'flytipping off road sent to extra email' => sub { is $report->external_id, undef, 'Report has right external ID'; }; +my ($report2) = $mech->create_problems_for_body(1, $body->id, 'Drainage problem', { + category => 'Blocked drain', cobrand => 'fixmystreet', + latitude => 51.812244, longitude => -0.827363, +}); + +subtest 'blocked drain sent to extra email' => sub { + $mech->clear_emails_ok; + FixMyStreet::Script::Reports::send(); + my $email = $mech->get_email; + my $e = join('@', 'floodmanagement', 'buckscc.gov.uk'); + is $email->header('To'), '"Flood Management" <' . $e . '>'; +}; + $cobrand = FixMyStreet::Cobrand::Buckinghamshire->new(); subtest 'Flytipping extra question used if necessary' => sub { @@ -183,7 +198,7 @@ subtest 'extra CSV columns are present' => sub { $mech->get_ok('/dashboard?export=1'); my @rows = $mech->content_as_csv; - is scalar @rows, 4, '1 (header) + 3 (reports) = 4 lines'; + is scalar @rows, 5, '1 (header) + 4 (reports) = 5 lines'; is scalar @{$rows[0]}, 21, '21 columns present'; is_deeply $rows[0], |