Commit | Line | Data |
dd4e6fd2 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
a2e038a1 |
7 | use lib "$FindBin::Bin/lib"; |
dd4e6fd2 |
8 | |
c20bd9d9 |
9 | use Test::More tests => 30; |
dd4e6fd2 |
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 | } |