X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_engine_response_status.t;fp=t%2Faggregate%2Flive_engine_response_status.t;h=a37c9b66bd294de885174f7af1401d7917c49696;hb=42da66a91b0a87ebb81d8552bcd0b05d3557c83e;hp=0000000000000000000000000000000000000000;hpb=1faaa3e99565660c7e3cd433e01c80343828f8a8;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_engine_response_status.t b/t/aggregate/live_engine_response_status.t new file mode 100644 index 0000000..a37c9b6 --- /dev/null +++ b/t/aggregate/live_engine_response_status.t @@ -0,0 +1,55 @@ +#!perl + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; + +use Test::More tests => 30; +use Catalyst::Test 'TestApp'; + +{ + ok( my $response = request('http://localhost/engine/response/status/s200'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->code, 200, 'Response Code' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), 'engine/response/status/s200', 'Test Action' ); + like( $response->content, qr/^200/, 'Response Content' ); +} + +{ + ok( my $response = request('http://localhost/engine/response/status/s400'), 'Request' ); + ok( $response->is_error, 'Response Client Error 4xx' ); + is( $response->code, 400, 'Response Code' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), 'engine/response/status/s400', 'Test Action' ); + like( $response->content, qr/^400/, 'Response Content' ); +} + +{ + ok( my $response = request('http://localhost/engine/response/status/s403'), 'Request' ); + ok( $response->is_error, 'Response Client Error 4xx' ); + is( $response->code, 403, 'Response Code' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), 'engine/response/status/s403', 'Test Action' ); + like( $response->content, qr/^403/, 'Response Content' ); +} + +{ + ok( my $response = request('http://localhost/engine/response/status/s404'), 'Request' ); + ok( $response->is_error, 'Response Client Error 4xx' ); + is( $response->code, 404, 'Response Code' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), 'engine/response/status/s404', 'Test Action' ); + like( $response->content, qr/^404/, 'Response Content' ); +} + +{ + ok( my $response = request('http://localhost/engine/response/status/s500'), 'Request' ); + ok( $response->is_error, 'Response Server Error 5xx' ); + is( $response->code, 500, 'Response Code' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), 'engine/response/status/s500', 'Test Action' ); + like( $response->content, qr/^500/, 'Response Content' ); +}