aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock
diff options
context:
space:
mode:
Diffstat (limited to 't/Mock')
-rw-r--r--t/Mock/MapIt.pm1
-rw-r--r--t/Mock/Tilma.pm39
2 files changed, 40 insertions, 0 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 96be429e4..cd441856a 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -39,6 +39,7 @@ my @PLACES = (
[ 'LE15 0GJ', 52.670447, -0.727877, 2600, 'Rutland County Council', 'CTY'],
[ 'BR1 3UH', 51.4021, 0.01578, 2482, 'Bromley Council', 'LBO' ],
[ 'BR1 3UH', 51.402096, 0.015784, 2482, 'Bromley Council', 'LBO' ],
+ [ 'BR1 3EF', 51.4039, 0.018697, 2482, 'Bromley Council', 'LBO' ],
[ 'NN1 1NS', 52.236251, -0.892052, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
[ 'NN1 2NS', 52.238301, -0.889992, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
[ '?', 52.238827, -0.894970, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ],
diff --git a/t/Mock/Tilma.pm b/t/Mock/Tilma.pm
new file mode 100644
index 000000000..5a11209e3
--- /dev/null
+++ b/t/Mock/Tilma.pm
@@ -0,0 +1,39 @@
+package t::Mock::Tilma;
+
+use JSON::MaybeXS;
+use Web::Simple;
+
+has json => (
+ is => 'lazy',
+ default => sub {
+ JSON->new->utf8->pretty->allow_blessed->convert_blessed;
+ },
+);
+
+sub dispatch_request {
+ my $self = shift;
+
+ sub (GET + /mapserver/tfl + ?*) {
+ my ($self, $args) = @_;
+ my $features = [];
+ if ($args->{Filter} =~ /540512,169141/) {
+ $features = [
+ { type => "Feature", properties => { HA_ID => "19" }, geometry => { type => "Polygon", coordinates => [ [
+ [ 539408.94, 170607.58 ],
+ [ 539432.81, 170627.93 ],
+ [ 539437.24, 170623.48 ],
+ [ 539408.94, 170607.58 ],
+ ] ] } } ];
+ }
+ my $json = mySociety::Locale::in_gb_locale {
+ $self->json->encode({
+ type => "FeatureCollection",
+ crs => { type => "name", properties => { name => "urn:ogc:def:crs:EPSG::27700" } },
+ features => $features,
+ });
+ };
+ return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
+ },
+}
+
+__PACKAGE__->run_if_script;