aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand/tfl.t
diff options
context:
space:
mode:
Diffstat (limited to 't/cobrand/tfl.t')
-rw-r--r--t/cobrand/tfl.t42
1 files changed, 33 insertions, 9 deletions
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t
index 69b112323..a327a00ef 100644
--- a/t/cobrand/tfl.t
+++ b/t/cobrand/tfl.t
@@ -384,16 +384,16 @@ subtest "change category, report resent to new location" => sub {
};
for my $test (
- [ 'BR1 3UH', 'tfl.fixmystreet.com', 'Trees', 'TfL <bromley@example.com>', 'Bromley borough team' ],
- [ 'BR1 3UH', 'www.fixmystreet.com', 'Trees', 'TfL <bromley@example.com>', 'Bromley borough team' ],
- [ 'BR1 3UH', 'bromley.fixmystreet.com', 'Trees', 'TfL <bromley@example.com>', 'Bromley borough team' ],
- [ 'TW7 5JN', 'tfl.fixmystreet.com', 'Trees', 'TfL <hounslow@example.com>', 'Hounslow borough team' ],
- [ 'TW7 5JN', 'www.fixmystreet.com', 'Trees', 'TfL <hounslow@example.com>', 'Hounslow borough team' ],
- [ 'TW7 5JN', 'tfl.fixmystreet.com', 'Grit bins', 'TfL <hounslow@example.com>, TfL <gritbins@example.com>', 'Hounslow borough team and additional address' ],
- [ 'TW7 5JN', 'www.fixmystreet.com', 'Grit bins', 'TfL <hounslow@example.com>, TfL <gritbins@example.com>', 'Hounslow borough team and additional address' ],
+ [ 'BR1 3UH', 'tfl.fixmystreet.com', 'Trees', 'TfL <bromley@example.com>', 'Bromley borough team', 'reference number is FMS' ],
+ [ 'BR1 3UH', 'www.fixmystreet.com', 'Trees', 'TfL <bromley@example.com>', 'Bromley borough team', 'reference number is' ],
+ [ 'BR1 3UH', 'bromley.fixmystreet.com', 'Trees', 'TfL <bromley@example.com>', 'Bromley borough team', '' ],
+ [ 'TW7 5JN', 'tfl.fixmystreet.com', 'Trees', 'TfL <hounslow@example.com>', 'Hounslow borough team', 'reference number is FMS' ],
+ [ 'TW7 5JN', 'www.fixmystreet.com', 'Trees', 'TfL <hounslow@example.com>', 'Hounslow borough team', 'reference number is' ],
+ [ 'TW7 5JN', 'tfl.fixmystreet.com', 'Grit bins', 'TfL <hounslow@example.com>, TfL <gritbins@example.com>', 'Hounslow borough team and additional address', 'reference number is FMS' ],
+ [ 'TW7 5JN', 'www.fixmystreet.com', 'Grit bins', 'TfL <hounslow@example.com>, TfL <gritbins@example.com>', 'Hounslow borough team and additional address', 'reference number is' ],
) {
- my ($postcode, $host, $category, $to, $name ) = @$test;
- subtest "test report is sent to $name" => sub {
+ my ($postcode, $host, $category, $to, $name, $ref ) = @$test;
+ subtest "test report is sent to $name on $host" => sub {
$mech->host($host);
$mech->log_in_ok( $user->email );
$mech->get_ok('/around');
@@ -422,6 +422,9 @@ for my $test (
FixMyStreet::Script::Reports::send();
my @email = $mech->get_email;
is $email[0]->header('To'), $to, 'Sent to correct address';
+ like $email[0]->as_string, qr/iEYI87gX6Upb\+tKYzrSmN83pTnv606AOtahHTepSm/, 'Right logo';
+ like $mech->get_text_body_from_email($email[0]), qr/https:\/\/street.tfl/, 'Correct link';
+ like $mech->get_text_body_from_email($email[1]), qr/$ref/, "Correct reference number in reporter email" if $ref;
$mech->clear_emails_ok;
FixMyStreet::DB->resultset("Problem")->find({ title => 'Test Report for borough team'})->delete;
};
@@ -826,6 +829,27 @@ FixMyStreet::override_config {
};
FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet', 'tfl' ],
+ MAPIT_URL => 'http://mapit.uk/'
+}, sub {
+ foreach (qw(tfl.fixmystreet.com fixmystreet.com)) {
+ $mech->host($_);
+ my ($p) = $mech->create_problems_for_body(1, $body->id, 'NotResp');
+ my $c = FixMyStreet::DB->resultset('Comment')->create({
+ problem => $p, user => $p->user, anonymous => 't', text => 'Update text',
+ problem_state => 'not responsible', state => 'confirmed', mark_fixed => 0,
+ confirmed => DateTime->now(),
+ });
+ subtest "check not responsible as correct text on $_" => sub {
+ $mech->get_ok('/report/' . $p->id);
+ $mech->content_contains("not TfL’s responsibility", "not reponsible message contains correct text");
+ };
+ $p->comments->delete;
+ $p->delete;
+ }
+};
+
+FixMyStreet::override_config {
ALLOWED_COBRANDS => 'bromley',
MAPIT_URL => 'http://mapit.uk/'
}, sub {