aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/reports.t2
-rw-r--r--t/app/helpers/send_email.t10
-rw-r--r--t/app/helpers/send_email_sample.txt2
-rw-r--r--t/app/helpers/send_email_sample_mime.txt2
-rw-r--r--t/app/model/alert_type.t27
5 files changed, 27 insertions, 16 deletions
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index ac230ef95..670c5cfc3 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -139,7 +139,7 @@ FixMyStreet::override_config {
is $mech->uri->path, '/reports/Birmingham/Bordesley+and+Highgate';
$mech->get_ok('/reports/Birmingham/Bordesley+and+Highgate|Birchfield');
is $mech->uri->path, '/reports/Birmingham/Bordesley+and+Highgate%7CBirchfield';
- $mech->content_contains('Birchfield, Bordesley & Highgate');
+ $mech->content_contains('Birchfield, Bordesley & Highgate');
};
$mech->get_ok('/reports/Westminster');
diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t
index 58b9acaaa..522ee39d0 100644
--- a/t/app/helpers/send_email.t
+++ b/t/app/helpers/send_email.t
@@ -17,7 +17,7 @@ my $mech = FixMyStreet::TestMech->new;
my $c = ctx_request("/");
# set some values in the stash
-$c->stash->{foo} = 'bar';
+$c->stash->{foo} = 'bar <b>bold</b>';
# clear the email queue
$mech->clear_emails_ok;
@@ -118,6 +118,14 @@ subtest 'Inline emails!' => sub {
\ {10}\+\ text/plain.*\n
\ {10}\+\ text/html.*\n
\ {5}\+\ image/gif]x;
+ $email->walk_parts(sub {
+ my ($part) = @_;
+ if ($part->content_type =~ m[text/plain]i) {
+ like $part->body_str, qr/foo: bar <b>bold<\/b>/;
+ } elsif ($part->content_type =~ m[text/html]i) {
+ like $part->body_str, qr/foo: bar &lt;b&gt;bold&lt;\/b&gt;/;
+ }
+ });
$mech->clear_emails_ok;
};
diff --git a/t/app/helpers/send_email_sample.txt b/t/app/helpers/send_email_sample.txt
index 68fe61f0e..e14c536be 100644
--- a/t/app/helpers/send_email_sample.txt
+++ b/t/app/helpers/send_email_sample.txt
@@ -7,7 +7,7 @@ From: CONTACT_EMAIL
Hello,
-This is a test email where foo: bar.
+This is a test email where foo: bar <b>bold</b>.
utf8: =E6=88=91=E4=BB=AC=E5=BA=94=E8=AF=A5=E8=83=BD=E5=A4=9F=E6=97=A0=E7=BC=
=9D=E5=A4=84=E7=90=86UTF8=E7=BC=96=E7=A0=81
diff --git a/t/app/helpers/send_email_sample_mime.txt b/t/app/helpers/send_email_sample_mime.txt
index 7b4ce91f6..623874149 100644
--- a/t/app/helpers/send_email_sample_mime.txt
+++ b/t/app/helpers/send_email_sample_mime.txt
@@ -12,7 +12,7 @@ Content-Transfer-Encoding: quoted-printable
Hello,
-This is a test email where foo: bar.
+This is a test email where foo: bar <b>bold</b>.
utf8: =E6=88=91=E4=BB=AC=E5=BA=94=E8=AF=A5=E8=83=BD=E5=A4=9F=E6=97=A0=E7=BC=
=9D=E5=A4=84=E7=90=86UTF8=E7=BC=96=E7=A0=81
diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t
index ecca2df3d..42bed37eb 100644
--- a/t/app/model/alert_type.t
+++ b/t/app/model/alert_type.t
@@ -337,6 +337,8 @@ foreach my $test (
};
}
+my $hart = $mech->create_body_ok(2333, 'Hart');
+
my $ward_alert = FixMyStreet::DB->resultset('Alert')->find_or_create(
{
user => $user,
@@ -351,7 +353,7 @@ my $ward_alert = FixMyStreet::DB->resultset('Alert')->find_or_create(
my $report_to_council = FixMyStreet::DB->resultset('Problem')->find_or_create(
{
postcode => 'WS13 6YY',
- bodies_str => '2434',
+ bodies_str => $hart->id,
areas => ',105255,11806,11828,2247,2504,7117,',
category => 'Other',
title => 'council report',
@@ -375,7 +377,7 @@ my $report_to_council = FixMyStreet::DB->resultset('Problem')->find_or_create(
my $report_to_county_council = FixMyStreet::DB->resultset('Problem')->find_or_create(
{
postcode => 'WS13 6YY',
- bodies_str => '2240',
+ bodies_str => '2227',
areas => ',105255,11806,11828,2247,2504,7117,',
category => 'Other',
title => 'county report',
@@ -430,21 +432,22 @@ subtest "check alerts from cobrand send main site url for alerts for different c
)->delete;
FixMyStreet::override_config {
+ ALLOWED_COBRANDS => ['hart', 'fixmystreet'],
+ BASE_URL => 'https://national.example.org',
MAPIT_URL => 'http://mapit.uk/',
}, sub {
FixMyStreet::DB->resultset('AlertType')->email_alerts();
- };
-
- my $body = $mech->get_text_body_from_email;
- my $expected1 = FixMyStreet->config('BASE_URL') . '/report/' . $report_to_county_council->id;
- my $expected3 = FixMyStreet->config('BASE_URL') . '/report/' . $report_outside_district->id;
- my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('hart')->new();
- my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+ my $body = $mech->get_text_body_from_email;
- like $body, qr#$expected1#, 'non cobrand area report point to fixmystreet.com';
- like $body, qr#$expected2#, 'cobrand area report point to cobrand url';
- like $body, qr#$expected3#, 'report outside district report point to fixmystreet.com';
+ my $expected1 = FixMyStreet->config('BASE_URL') . '/report/' . $report_to_county_council->id;
+ my $expected3 = FixMyStreet->config('BASE_URL') . '/report/' . $report_outside_district->id;
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('hart')->new();
+ my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+ like $body, qr#$expected1#, 'non cobrand area report point to fixmystreet.com';
+ like $body, qr#$expected2#, 'cobrand area report point to cobrand url';
+ like $body, qr#$expected3#, 'report outside district report point to fixmystreet.com';
+ };
};