Merged 5.49_01 (r1339) from refactored branch to trunk
[catagits/Catalyst-Runtime.git] / t / live / engine / response / status.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/../../lib";
8
9 use Test::More tests => 30;
10 use Catalyst::Test 'TestApp';
11
12 {
13     ok( my $response = request('http://localhost/engine/response/status/s200'), 'Request' );
14     ok( $response->is_success, 'Response Successful 2xx' );
15     is( $response->code, 200, 'Response Code' );
16     is( $response->content_type, 'text/plain', 'Response Content-Type' );
17     is( $response->header('X-Catalyst-Action'), 'engine/response/status/s200', 'Test Action' );
18     like( $response->content, qr/^200/, 'Response Content' );
19 }
20
21 {
22     ok( my $response = request('http://localhost/engine/response/status/s400'), 'Request' );
23     ok( $response->is_error, 'Response Client Error 4xx' );
24     is( $response->code, 400, 'Response Code' );
25     is( $response->content_type, 'text/plain', 'Response Content-Type' );
26     is( $response->header('X-Catalyst-Action'), 'engine/response/status/s400', 'Test Action' );
27     like( $response->content, qr/^400/, 'Response Content' );
28 }
29
30 {
31     ok( my $response = request('http://localhost/engine/response/status/s403'), 'Request' );
32     ok( $response->is_error, 'Response Client Error 4xx' );
33     is( $response->code, 403, 'Response Code' );
34     is( $response->content_type, 'text/plain', 'Response Content-Type' );
35     is( $response->header('X-Catalyst-Action'), 'engine/response/status/s403', 'Test Action' );
36     like( $response->content, qr/^403/, 'Response Content' );
37 }
38
39 {
40     ok( my $response = request('http://localhost/engine/response/status/s404'), 'Request' );
41     ok( $response->is_error, 'Response Client Error 4xx' );
42     is( $response->code, 404, 'Response Code' );
43     is( $response->content_type, 'text/plain', 'Response Content-Type' );
44     is( $response->header('X-Catalyst-Action'), 'engine/response/status/s404', 'Test Action' );
45     like( $response->content, qr/^404/, 'Response Content' );
46 }
47
48 {
49     ok( my $response = request('http://localhost/engine/response/status/s500'), 'Request' );
50     ok( $response->is_error, 'Response Server Error 5xx' );
51     is( $response->code, 500, 'Response Code' );
52     is( $response->content_type, 'text/plain', 'Response Content-Type' );
53     is( $response->header('X-Catalyst-Action'), 'engine/response/status/s500', 'Test Action' );
54     like( $response->content, qr/^500/, 'Response Content' );
55 }