aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/index.t
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller/index.t')
-rw-r--r--t/app/controller/index.t29
1 files changed, 24 insertions, 5 deletions
diff --git a/t/app/controller/index.t b/t/app/controller/index.t
index 11c59d289..cebeaf676 100644
--- a/t/app/controller/index.t
+++ b/t/app/controller/index.t
@@ -10,6 +10,7 @@ $mech->get_ok('/');
subtest "check that the form goes to /around" => sub {
$mech->get_ok('/');
+ is $mech->uri->path, '/', "still on '/'";
# submit form
$mech->submit_form_ok( { with_fields => { pc => 'SW1A 1AA', } } );
@@ -20,19 +21,37 @@ subtest "check that the form goes to /around" => sub {
"query passed along";
};
-subtest "check that requests with pc, x,y or lat,lon go to /around" => sub {
+subtest "does pc, (x,y), (e,n) or (lat,lon) go to /around" => sub {
+
foreach my $test ( #
- { pc => 'SW1A 1AA' }, #
- { lat => 51.50100, lon => -0.14158 },
+ {
+ in => { pc => 'SW1A 1AA' },
+ out => { pc => 'SW1A 1AA' },
+ },
+ {
+ in => { lat => 51.50100, lon => -0.14158 },
+ out => { lat => 51.50100, lon => -0.14158 },
+ },
+ {
+ in => { x => 3281, y => 1113, },
+ out => { lat => 51.4998246332569, lon => -0.140137309739907 },
+ },
+ {
+ in => { e => 1234, n => 4567 },
+ out => { lat => 49.808509, lon => -7.544784 },
+ },
)
{
+
my $uri = URI->new('http://localhost/');
- $uri->query_form($test);
+ $uri->query_form( $test->{in} );
+
+ # get the uri and check for 302
$mech->get_ok($uri);
# check that we are at /around
is $mech->uri->path, '/around', "Got to /around";
- is_deeply { $mech->uri->query_form }, $test, "query passed along";
+ is_deeply { $mech->uri->query_form }, $test->{out}, "query correct";
}
};