aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--t/cobrand/isleofwight.t92
-rw-r--r--templates/email/isleofwight/problem-confirm.html31
-rw-r--r--templates/email/isleofwight/problem-confirm.txt31
-rw-r--r--templates/email/isleofwight/signature.txt2
4 files changed, 156 insertions, 0 deletions
diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t
index c30ea1987..745b378dc 100644
--- a/t/cobrand/isleofwight.t
+++ b/t/cobrand/isleofwight.t
@@ -3,6 +3,8 @@ use DateTime;
use FixMyStreet::TestMech;
use Open311;
use Open311::GetServiceRequestUpdates;
+use FixMyStreet::Script::Alerts;
+use FixMyStreet::Script::Reports;
ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );
@@ -57,6 +59,8 @@ subtest "only original reporter can comment" => sub {
};
};
+$_->delete for @reports;
+
my $system_user = $mech->create_user_ok('system_user@example.org');
for my $status ( qw/ CLOSED FIXED DUPLICATE NOT_COUNCILS_RESPONSIBILITY NO_FURTHER_ACTION / ) {
@@ -105,6 +109,8 @@ for my $status ( qw/ CLOSED FIXED DUPLICATE NOT_COUNCILS_RESPONSIBILITY NO_FURTH
$p->discard_changes;
is $p->get_extra_metadata('closed_updates'), 1, "report closed to updates";
+ $p->comments->delete;
+ $p->delete;
};
}
@@ -145,7 +151,93 @@ subtest "fixing passes along the correct message" => sub {
is $id, 248, 'correct update ID returned';
$cgi = CGI::Simple->new($o->test_req_used->content);
like $cgi->param('description'), qr/^FMS-Update: \[The customer indicated that this issue had been fixed/, 'Fixed message included';
+ $p->comments->delete;
+ $p->delete;
+ };
+};
+
+my ($p) = $mech->create_problems_for_body(1, $isleofwight->id, '', { cobrand => 'isleofwight' });
+my $alert = FixMyStreet::App->model('DB::Alert')->create( {
+ parameter => $p->id,
+ alert_type => 'new_updates',
+ user => $user,
+ cobrand => 'isleofwight',
+} )->confirm;
+
+subtest "sends branded alert emails" => sub {
+ $mech->create_comment_for_problem($p, $system_user, 'Other User', 'This is some update text', 'f', 'confirmed', undef, { confirmed => DateTime->now->add( minutes => 5 ) });
+ $mech->clear_emails_ok;
+
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ ALLOWED_COBRANDS => ['isleofwight','fixmystreet'],
+ }, sub {
+ FixMyStreet::Script::Alerts::send();
+ };
+
+ $mech->email_count_is(1);
+ my $email = $mech->get_email;
+ ok $email, "got an email";
+ like $mech->get_text_body_from_email($email), qr/Island Roads/, "emails are branded";
+};
+
+$p->comments->delete;
+$p->delete;
+
+subtest "sends branded confirmation emails" => sub {
+ $mech->log_out_ok;
+ $mech->clear_emails_ok;
+ $mech->get_ok('/around');
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'isleofwight' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'PO30 5XJ', } },
+ "submit location" );
+
+ # click through to the report page
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
+
+ $mech->submit_form_ok(
+ {
+ button => 'submit_register',
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo1 => '',
+ name => 'Joe Bloggs',
+ username => 'test-1@example.com',
+ category => 'Potholes',
+ }
+ },
+ "submit good details"
+ );
+
+ $mech->email_count_is(1);
+ my $email = $mech->get_email;
+ ok $email, "got an email";
+ like $mech->get_text_body_from_email($email), qr/Island Roads/, "emails are branded";
+
+ my $url = $mech->get_link_from_email($email);
+ $mech->get_ok($url);
+ $mech->clear_emails_ok;
+ };
+};
+
+subtest "sends branded report sent emails" => sub {
+ $mech->clear_emails_ok;
+ FixMyStreet::override_config {
+ STAGING_FLAGS => { send_reports => 1 },
+ MAPIT_URL => 'http://mapit.uk/',
+ ALLOWED_COBRANDS => ['isleofwight','fixmystreet'],
+ }, sub {
+ FixMyStreet::Script::Reports::send();
};
+ $mech->email_count_is(1);
+ my $email = $mech->get_email;
+ ok $email, "got an email";
+ like $mech->get_text_body_from_email($email), qr/Island Roads/, "emails are branded";
};
done_testing();
diff --git a/templates/email/isleofwight/problem-confirm.html b/templates/email/isleofwight/problem-confirm.html
new file mode 100644
index 000000000..ccdefc7aa
--- /dev/null
+++ b/templates/email/isleofwight/problem-confirm.html
@@ -0,0 +1,31 @@
+[%
+
+email_summary = "You need to confirm your " _ site_name _ " report before it can be sent to Island Roads.";
+email_columns = 2;
+
+PROCESS '_email_settings.html';
+
+INCLUDE '_email_top.html';
+
+%]
+
+<th style="[% td_style %][% primary_column_style %]" id="primary_column">
+ [% start_padded_box %]
+ <h1 style="[% h1_style %]">Please confirm your&nbsp;report</h1>
+ <p style="[% p_style %]">Please click on the link below to confirm that you want to send your report to Island Roads.
+
+[% TRY %][% INCLUDE '_problem-confirm_extra.html' %][% CATCH file %][% END %]
+ </p>
+ [% UNLESS report.non_public %]<p style="[% p_style %]">Your report will also appear on the [% site_name %] website.</p>[% END %]
+ <p style="margin: 20px auto; text-align: center">
+ <a style="[% button_style %]" href="[% token_url %]">Yes, send my report</a>
+ </p>
+ <p style="[% p_style %]">If you no longer wish to send this report, please take no further action.</p>
+ [% end_padded_box %]
+</th>
+[% WRAPPER '_email_sidebar.html' object = report, url = token_url %]
+ <h2 style="[% h2_style %]">[% report.title | html %]</h2>
+ <p style="[% secondary_p_style %]">[% report.detail | html %]</p>
+[% END %]
+
+[% INCLUDE '_email_bottom.html' %]
diff --git a/templates/email/isleofwight/problem-confirm.txt b/templates/email/isleofwight/problem-confirm.txt
new file mode 100644
index 000000000..20a871453
--- /dev/null
+++ b/templates/email/isleofwight/problem-confirm.txt
@@ -0,0 +1,31 @@
+Subject: Confirm your report on [% site_name %]
+
+Hello [% report.name %],
+
+Please click on the link below to confirm that you want to send your report to
+Island Roads.[% UNLESS report.non_public %] Note that your report will also
+appear on the [% site_name %] website.[% END %]
+
+[% token_url %]
+
+If your email program does not let you click on this link, copy and paste it
+into your web browser and press return.
+[% TRY %][% INCLUDE '_problem-confirm_extra.txt' %][% CATCH file %][% END %]
+Your problem had the title:
+
+[% report.title %]
+
+And details:
+
+[% report.detail %]
+
+If you no longer wish to send this report, please take no further action.
+
+Thank you for submitting a report through [% site_name %].
+
+
+
+[% signature %]
+
+This email was sent automatically, from an unmonitored email account - so
+please do not reply to it.
diff --git a/templates/email/isleofwight/signature.txt b/templates/email/isleofwight/signature.txt
new file mode 100644
index 000000000..e375a0402
--- /dev/null
+++ b/templates/email/isleofwight/signature.txt
@@ -0,0 +1,2 @@
+
+Island Roads