aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-09-05 14:49:29 +0100
committerStruan Donald <struan@exo.org.uk>2017-09-20 17:02:34 +0100
commit7f1717234c0315e231bb2a4f582287d68e976fea (patch)
tree9d520abca7025b14230f04d16811f2a7077ad004 /t/Mock
parentebc2e1f227471ecaccd16eb897da27c193eddb65 (diff)
area stats page for staff users
Admin page to show some simple summary stats for an area. If the user has been assigned to an area then they will see the stats for that area. Superusers can pick which area they want to view. For mysociety/fixmystreetforcouncils#2
Diffstat (limited to 't/Mock')
-rw-r--r--t/Mock/MapIt.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 926d94b1e..6e3c5d673 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -92,8 +92,14 @@ sub dispatch_request {
sub (GET + /area/*) {
my ($self, $area) = @_;
- my $response = { "id" => $area, "name" => "Area $area", "type" => "UTA" };
- return $self->output($response);
+ my $response;
+ if ($area eq '999') {
+ $response = { code => 404, error => "No Area matches the given query." };
+ return [ 404, [ 'Content-Type' => 'application/json' ], [ $self->json->encode($response) ] ];
+ } else {
+ $response = { "id" => $area, "name" => "Area $area", "type" => "UTA" };
+ return $self->output($response);
+ }
},
sub (GET + /area/*/children) {