X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive%2Fengine%2Frequest%2Furi.t;fp=t%2Flive%2Fengine%2Frequest%2Furi.t;h=0000000000000000000000000000000000000000;hb=50cc3183118f1056427ab314b84b91fd0d9e1383;hp=b0a2f0a2d096b482c5a9e266a4e636addfc799ab;hpb=66741f94ac93b7ba0989db3556d0e3fe36c1be87;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live/engine/request/uri.t b/t/live/engine/request/uri.t deleted file mode 100644 index b0a2f0a..0000000 --- a/t/live/engine/request/uri.t +++ /dev/null @@ -1,61 +0,0 @@ -#!perl - -use strict; -use warnings; - -use FindBin; -use lib "$FindBin::Bin/../../lib"; - -use Test::More tests => 23; -use Catalyst::Test 'TestApp'; -use Catalyst::Request; - -my $creq; - -# test that the path can be changed -{ - ok( my $response = request('http://localhost/engine/request/uri/change_path'), 'Request' ); - ok( $response->is_success, 'Response Successful 2xx' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - like( $creq->uri, qr{/my/app/lives/here$}, 'URI contains new path' ); -} - -# test that path properly removes the base location -{ - ok( my $response = request('http://localhost/engine/request/uri/change_base'), 'Request' ); - ok( $response->is_success, 'Response Successful 2xx' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - like( $creq->base, qr{/new/location}, 'Base URI contains new location' ); - is( $creq->path, 'engine/request/uri/change_base', 'URI contains correct path' ); -} - -# test that base + path is correct -{ - ok( my $response = request('http://localhost/engine/request/uri'), 'Request' ); - ok( $response->is_success, 'Response Successful 2xx' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - is( $creq->base . $creq->path, $creq->uri, 'Base + Path ok' ); -} - -# test that we can use semi-colons as separators -{ - my $parameters = { - a => [ qw/1 2/ ], - b => 3, - }; - - ok( my $response = request('http://localhost/engine/request/uri?a=1;a=2;b=3'), 'Request' ); - ok( $response->is_success, 'Response Successful 2xx' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - is( $creq->{uri}->query, 'a=1;a=2;b=3', 'Query string ok' ); - is_deeply( $creq->{parameters}, $parameters, 'Parameters ok' ); -} - -# test that query params are unescaped properly -{ - ok( my $response = request('http://localhost/engine/request/uri?text=Catalyst%20Rocks'), 'Request' ); - ok( $response->is_success, 'Response Successful 2xx' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); - is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' ); - is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' ); -}