diff options
author | Marius Halden <marius.h@lden.org> | 2017-12-20 01:06:27 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2017-12-20 01:06:27 +0100 |
commit | 8b10c8b8d787e680bb085e2a7543dac50fd39742 (patch) | |
tree | 391efde6de4944e350cc0dafbd4e1efb0613e9c3 /t/Mock/MapIt.pm | |
parent | eef35397ccf8242cdc65dc666db2958b1ee35440 (diff) | |
parent | 7e15bd3db202363db4bab8fa7c9f462eabe28fce (diff) |
Merge tag 'v2.3' into fiksgatami-dev
Diffstat (limited to 't/Mock/MapIt.pm')
-rw-r--r-- | t/Mock/MapIt.pm | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm index 926d94b1e..8dd10c53d 100644 --- a/t/Mock/MapIt.pm +++ b/t/Mock/MapIt.pm @@ -81,10 +81,6 @@ sub dispatch_request { $self->output({2226 => {parent_area => undef, id => 2226, name => "Gloucestershire County Council", type => "CTY"}}); } elsif ($areas eq 'Cheltenham') { $self->output({2326 => {parent_area => undef, id => 2326, name => "Cheltenham Borough Council", type => "DIS"}}); - } elsif ($areas eq 'Lansdown and Park') { - $self->output({22261 => {parent_area => 2226, id => 22261, name => "Lansdown and Park", type => "CED"}}); - } elsif ($areas eq 'Lansdown') { - $self->output({23261 => {parent_area => 2326, id => 23261, name => "Lansdown", type => "DIW"}}); } elsif ($areas eq 'UTA') { $self->output({2650 => {parent_area => undef, id => 2650, name => "Aberdeen Council", type => "UTA"}}); } @@ -92,12 +88,30 @@ 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) { my ($self, $area) = @_; + if ($area eq '2514') { + return $self->output({ + 8794 => {parent_area => 2514, id => 8794, name => "Aston", type => "MTW"}, + 8773 => {parent_area => 2514, id => 8773, name => "Bournville", type => "MTW"}, + }); + } + if ($area eq '2326') { + return $self->output({23261 => {parent_area => 2326, id => 23261, name => "Lansdown", type => "DIW"}}); + } + if ($area eq '2226') { + return $self->output({22261 => {parent_area => 2226, id => 22261, name => "Lansdown and Park", type => "CED"}}); + } my $response = { "60705" => { "parent_area" => 2245, "generation_high" => 25, "all_names" => { }, "id" => 60705, "codes" => { "ons" => "00HY226", "gss" => "E04011842", "unit_id" => "17101" }, "name" => "Trowbridge", "country" => "E", "type_name" => "Civil parish/community", "generation_low" => 12, "country_name" => "England", "type" => "CPC" }, "62883" => { "parent_area" => 2245, "generation_high" => 25, "all_names" => { }, "id" => 62883, "codes" => { "ons" => "00HY026", "gss" => "E04011642", "unit_id" => "17205" }, "name" => "Bradford-on-Avon", "country" => "E", "type_name" => "Civil parish/community", "generation_low" => 12, "country_name" => "England", "type" => "CPC" }, |