aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-11-08 10:39:29 +0000
committerDave Arter <davea@mysociety.org>2019-12-09 12:50:07 +0000
commitc75acd2a3e8cc5abc10ea6ba116a078ca881944d (patch)
treecab2c09c3d50187c82c27a33b24a01ed2343d2a6 /t/cobrand
parentd2f56b45fd26955bafe9c216809230b94afbf9c3 (diff)
[TfL] Highlight safety critical reports in email subject
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/tfl.t22
1 files changed, 18 insertions, 4 deletions
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t
index 4ae21cdaa..14f7dce08 100644
--- a/t/cobrand/tfl.t
+++ b/t/cobrand/tfl.t
@@ -342,12 +342,14 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
{
name => "test non-safety critical category",
safety_critical => 'no',
- category => "Traffic lights"
+ category => "Traffic lights",
+ subject => "Problem Report: Test Report",
},
{
name => "test safety critical category",
safety_critical => 'yes',
- category => "Pothole"
+ category => "Pothole",
+ subject => "Dangerous Pothole Report: Test Report",
},
{
name => "test category extra field - safety critical",
@@ -355,7 +357,8 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
category => "Flooding",
extra_fields => {
location => "carriageway",
- }
+ },
+ subject => "Dangerous Flooding Report: Test Report",
},
{
name => "test category extra field - non-safety critical",
@@ -363,7 +366,8 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
category => "Flooding",
extra_fields => {
location => "footway",
- }
+ },
+ subject => "Problem Report: Test Report",
},
) {
subtest $test->{name} . ' on ' . $host => sub {
@@ -407,6 +411,16 @@ for my $host ( 'tfl.fixmystreet.com', 'www.fixmystreet.com', 'bromley.fixmystree
is $report->get_extra_field_value('safety_critical'), $test->{safety_critical}, "safety critical flag set to " . $test->{safety_critical};
+ $mech->clear_emails_ok;
+ FixMyStreet::Script::Reports::send();
+ my @email = $mech->get_email;
+ is $email[0]->header('Subject'), $test->{subject};
+ if ($test->{safety_critical} eq 'yes') {
+ like $mech->get_text_body_from_email($email[0]), qr/This report is marked as safety critical./, "Safety critical message included in email body";
+ }
+ $mech->clear_emails_ok;
+
+
$mech->log_out_ok;
};
}