aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock/MapItZurich.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-12-06 11:57:34 +0000
committerDave Arter <davea@mysociety.org>2016-12-06 12:16:22 +0000
commit102418842a833c29f855557bf4c410290b5a2020 (patch)
treed639ff3adbd2fecadfd5ac1266cccf65db093f47 /t/Mock/MapItZurich.pm
parent7df5f6d00c34580987509a2ccb4520d2fde96866 (diff)
[Zurich] Fix 500 error when editing superusers
The Zurich::admin_type function was setting $c->stash->{body}, meaning that when trying to edit a superuser the 'fetch_contacts' function wasn't being called, causing an "Can't call method "all" on an undefined value" error as $c->stash->{live_contacts} wasn't ever being set. Fixed by changing the conditional to simply determine whether fetch_contacts needs to be called. Included a regression test that meant a small addition to the MapItZurich mock.
Diffstat (limited to 't/Mock/MapItZurich.pm')
-rw-r--r--t/Mock/MapItZurich.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/Mock/MapItZurich.pm b/t/Mock/MapItZurich.pm
index ece9a9b22..9195749f6 100644
--- a/t/Mock/MapItZurich.pm
+++ b/t/Mock/MapItZurich.pm
@@ -38,6 +38,12 @@ sub dispatch_request {
my $json = $self->json->encode({});
return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
},
+
+ sub (GET + /area/*/children) {
+ my ($self, $area) = @_;
+ my $json = $self->json->encode({});
+ return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
+ },
}
__PACKAGE__->run_if_script;