Commit | Line | Data |
affa35d5 |
1 | #!perl |
6bc86362 |
2 | use strict; |
3 | use warnings; |
4 | use lib 'lib'; |
74649ca9 |
5 | use Test::More tests => 29; |
6bc86362 |
6 | use lib 't/lib'; |
7 | use Test::WWW::Mechanize::Catalyst 'Catty'; |
8 | |
9 | my $root = "http://localhost"; |
10 | |
11 | my $m; |
12 | foreach my $where (qw{hi greetings bonjour}) { |
13 | $m = Test::WWW::Mechanize::Catalyst->new; |
14 | $m->get_ok( "$root/$where", "got something when we $where" ); |
15 | |
16 | is( $m->base, "http://localhost/hello", "check got to hello 1/4" ); |
17 | is( $m->ct, "text/html", "check got to hello 2/4" ); |
18 | $m->title_is( "Hello",, "check got to hello 3/4" ); |
19 | $m->content_contains( "Hi there",, "check got to hello 4/4" ); |
20 | |
21 | # check that the previous response is still there |
22 | my $prev = $m->response->previous; |
23 | ok( $prev, "have a previous" ); |
24 | is( $prev->code, 302, "was a redirect" ); |
25 | like( $prev->header('Location'), '/hello$/', "to the right place" ); |
26 | } |
27 | |
28 | # extra checks for bonjour (which is a double redirect) |
29 | my $prev = $m->response->previous->previous; |
30 | ok( $prev, "have a previous previous" ); |
31 | is( $prev->code, 302, "was a redirect" ); |
32 | like( $prev->header('Location'), '/hi$/', "to the right place" ); |
affa35d5 |
33 | |
34 | $m->get("$root/redirect_with_500"); |
35 | is ($m->status, 500, "Redirect not followed on 500"); |
74649ca9 |
36 | |
37 | $m->get_ok( "$root/redirect_to_utf8_upgraded_string", |
38 | "redirect using an upgraded utf8 string" ); |
39 | |