File: live_engine_response_status.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (53 lines) | stat: -rw-r--r-- 2,326 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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' );
}