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