1#!perl
2
3BEGIN {
4  unless ($ENV{AUTHOR_TESTING}) {
5    require Test::More;
6    Test::More::plan(skip_all => 'these tests are for testing by the author');
7  }
8}
9
10
11use strict;
12use warnings;
13
14use FindBin;
15use lib "$FindBin::Bin/lib";
16
17use Test::More tests => 30;
18use Catalyst::Test 'TestApp';
19
20{
21    ok( my $response = request('http://localhost/engine/response/status/s200'), 'Request' );
22    ok( $response->is_success, 'Response Successful 2xx' );
23    is( $response->code, 200, 'Response Code' );
24    is( $response->content_type, 'text/plain', 'Response Content-Type' );
25    is( $response->header('X-Catalyst-Action'), 'engine/response/status/s200', 'Test Action' );
26    like( $response->content, qr/^200/, 'Response Content' );
27}
28
29{
30    ok( my $response = request('http://localhost/engine/response/status/s400'), 'Request' );
31    ok( $response->is_error, 'Response Client Error 4xx' );
32    is( $response->code, 400, 'Response Code' );
33    is( $response->content_type, 'text/plain', 'Response Content-Type' );
34    is( $response->header('X-Catalyst-Action'), 'engine/response/status/s400', 'Test Action' );
35    like( $response->content, qr/^400/, 'Response Content' );
36}
37
38{
39    ok( my $response = request('http://localhost/engine/response/status/s403'), 'Request' );
40    ok( $response->is_error, 'Response Client Error 4xx' );
41    is( $response->code, 403, 'Response Code' );
42    is( $response->content_type, 'text/plain', 'Response Content-Type' );
43    is( $response->header('X-Catalyst-Action'), 'engine/response/status/s403', 'Test Action' );
44    like( $response->content, qr/^403/, 'Response Content' );
45}
46
47{
48    ok( my $response = request('http://localhost/engine/response/status/s404'), 'Request' );
49    ok( $response->is_error, 'Response Client Error 4xx' );
50    is( $response->code, 404, 'Response Code' );
51    is( $response->content_type, 'text/plain', 'Response Content-Type' );
52    is( $response->header('X-Catalyst-Action'), 'engine/response/status/s404', 'Test Action' );
53    like( $response->content, qr/^404/, 'Response Content' );
54}
55
56{
57    ok( my $response = request('http://localhost/engine/response/status/s500'), 'Request' );
58    ok( $response->is_error, 'Response Server Error 5xx' );
59    is( $response->code, 500, 'Response Code' );
60    is( $response->content_type, 'text/plain', 'Response Content-Type' );
61    is( $response->header('X-Catalyst-Action'), 'engine/response/status/s500', 'Test Action' );
62    like( $response->content, qr/^500/, 'Response Content' );
63}
64