diff options
author | Struan Donald <struan@exo.org.uk> | 2019-06-05 15:02:11 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2019-06-05 15:02:11 +0100 |
commit | 1a1be49646218b2217e25e82e6666749f78dc612 (patch) | |
tree | 24e5a6ce5db5e188760b98bf8037ce983bf5592b /t/app/controller | |
parent | 47f6782e851a1e15eb88888321c202794acfab30 (diff) |
make sure council_name exists before trying to call it
Not all cobrands have a council_name method.
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/report_new.t | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index d13f9d9ea..848529686 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1,3 +1,10 @@ +package FixMyStreet::Cobrand::HounslowNoName; +use base 'FixMyStreet::Cobrand::UK'; + +sub council_area_id { 2483 }; + +package main; + use Test::MockModule; use FixMyStreet::TestMech; use FixMyStreet::App; @@ -1401,6 +1408,14 @@ subtest "check map click ajax response" => 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'; + + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'hounslownoname', + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.482286&longitude=-0.328163' ); + }; + isnt defined $extra_details->{display_names}, 'no council display names if none defined'; }; #### test uploading an image |