1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use strict;
use warnings;
use Test::More;
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
subtest "check that if no query we get sent back to the homepage" => sub {
$mech->get_ok('/around');
is $mech->uri->path, '/', "sent back to '/'";
};
# x,y requests were generated by the old map code. We keep the behavior for
# historic links
subtest "redirect x,y requests to lat/lon (301 - permanent)" => sub {
$mech->get_ok('/around?x=3281&y=1113');
# did we redirect to lat,lon?
is $mech->uri->path, '/around', "still on /around";
is_deeply { $mech->uri->query_form },
{ lat => 51.4998246332569, lon => -0.140137309739907, },
"lat,lon correctly set";
# was it a 301?
is $mech->res->code, 200, "got 200 for final destination";
is $mech->res->previous->code, 301, "got 301 for redirect";
};
done_testing();
|