aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-05-30 14:00:57 +0100
committerDave Arter <davea@mysociety.org>2019-06-04 14:54:52 +0100
commit3139d214cdcb606c668793384559480a96819dfa (patch)
treeaec402df92dc11e160063115af6b9555a7dd0361 /t/app/controller
parent4f7985b6398e63fdc138ec4b74f175c2b9c2e006 (diff)
return council display names in ajax call
For some cobrands the display name of the council is not the same as the body name so add a display_names map to the reporting data returned over ajax. Use that in the staff automatic generation of basic report details.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_new.t14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index ae6f760d8..d13f9d9ea 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -52,6 +52,7 @@ for my $body (
{ area_id => 2237, name => 'Oxfordshire County Council' },
{ area_id => 2600, name => 'Rutland County Council' },
{ area_id => 2234, name => 'Northamptonshire County Council' },
+ { area_id => 2483, name => 'Hounslow Borough Council' },
) {
my $body_obj = $mech->create_body_ok($body->{area_id}, $body->{name});
push @bodies, $body_obj;
@@ -139,6 +140,11 @@ my $contact16 = $mech->create_contact_ok(
category => 'Trees',
email => 'trees-2234@example.com',
);
+my $contact17 = $mech->create_contact_ok(
+ body_id => $body_ids{2483}, # Hounslow
+ category => 'Trees',
+ email => 'trees-2483@example.com',
+);
# test that the various bit of form get filled in and errors correctly
# generated.
@@ -1387,6 +1393,14 @@ subtest "check map click ajax response" => sub {
is $extra_details->{category}, '', 'category is empty for council with no contacts';
is_deeply $extra_details->{bodies}, [ "Sandwell Borough Council" ], 'correct bodies for council with no contacts';
ok !$extra_details->{extra_name_info}, 'no extra name info';
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'hounslow',
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.482286&longitude=-0.328163' );
+ };
+ is_deeply $extra_details->{display_names}, { 'Hounslow Borough Council' => 'Hounslow Highways' }, 'council display name mapping correct';
};
#### test uploading an image