aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/bexley.t18
-rw-r--r--t/cobrand/hounslow.t18
2 files changed, 36 insertions, 0 deletions
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t
index 2f74ac03a..f6ec1014d 100644
--- a/t/cobrand/bexley.t
+++ b/t/cobrand/bexley.t
@@ -30,11 +30,13 @@ my $mech = FixMyStreet::TestMech->new;
my $body = $mech->create_body_ok(2494, 'London Borough of Bexley', {
send_method => 'Open311', api_key => 'key', 'endpoint' => 'e', 'jurisdiction' => 'j' });
$mech->create_contact_ok(body_id => $body->id, category => 'Abandoned and untaxed vehicles', email => "ABAN");
+$mech->create_contact_ok(body_id => $body->id, category => 'Lamp post', email => "LAMP");
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'bexley' ],
MAPIT_URL => 'http://mapit.uk/',
STAGING_FLAGS => { send_reports => 1, skip_checks => 0 },
+ COBRAND_FEATURES => { open311_email => { bexley => { p1 => 'p1@bexley', lighting => 'thirdparty@notbexley.example.com' } } },
}, sub {
subtest 'cobrand displays council name' => sub {
@@ -65,6 +67,22 @@ FixMyStreet::override_config {
my $email = $mech->get_email;
like $email->header('To'), qr/"Bexley P1 email".*bexley/;
like $mech->get_text_body_from_email($email), qr/NSG Ref: Road ID/;
+ $mech->clear_emails_ok;
+ };
+
+ ($report) = $mech->create_problems_for_body(1, $body->id, 'Lamp', {
+ category => 'Lamp post', cobrand => 'bexley',
+ latitude => 51.408484, longitude => 0.074653,
+ });
+
+ subtest 'Correct email sent' => sub {
+ my $test_data = FixMyStreet::Script::Reports::send();
+ my $req = $test_data->{test_req_used};
+ my $c = CGI::Simple->new($req->content);
+ is $c->param('service_code'), 'LAMP';
+
+ my $email = $mech->get_email;
+ like $email->header('To'), qr/thirdparty/;
};
};
diff --git a/t/cobrand/hounslow.t b/t/cobrand/hounslow.t
index 8fac848b1..43a5a5523 100644
--- a/t/cobrand/hounslow.t
+++ b/t/cobrand/hounslow.t
@@ -21,11 +21,18 @@ $mech->create_contact_ok(
$mech->create_problems_for_body(1, $hounslow_id, 'An old problem made before Hounslow FMS launched', {
confirmed => '2018-12-25 09:00',
lastupdate => '2018-12-25 09:00',
+ latitude => 51.482286,
+ longitude => -0.328163,
+
});
$mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on the Hounslow site', {
+ latitude => 51.482286,
+ longitude => -0.328163,
cobrand => 'hounslow'
});
my ($report) = $mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on fixmystreet.com', {
+ latitude => 51.482286,
+ longitude => -0.328163,
external_id => 'ABC123',
cobrand => 'fixmystreet'
});
@@ -49,7 +56,18 @@ subtest "it does not show old reports on Hounslow" => sub {
ALLOWED_COBRANDS => 'hounslow',
}, sub {
$mech->get_ok('/reports/Hounslow');
+ $mech->content_lacks('An old problem made before Hounslow FMS launched');
+ $mech->content_contains('A brand new problem made on the Hounslow site') or diag $mech->content;
+ $mech->content_contains('A brand new problem made on fixmystreet.com');
+ };
+};
+subtest "it shows the right things on an /around page" => sub {
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ ALLOWED_COBRANDS => 'hounslow',
+ }, sub {
+ $mech->get_ok('/around?pc=TW7+5JN');
$mech->content_lacks('An old problem made before Hounslow FMS launched');
$mech->content_contains('A brand new problem made on the Hounslow site') or diag $mech->content;
$mech->content_contains('A brand new problem made on fixmystreet.com');