File: live_engine_response_errors.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 (58 lines) | stat: -rw-r--r-- 1,771 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
54
55
56
57
58
use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/../lib";

use Test::More tests => 18;
use Catalyst::Test 'TestApp';

close STDERR;    # i'm naughty :)

{
    ok( my $response = request('http://localhost/engine/response/errors/one'),
        'Request' );
    ok( $response->is_error, 'Response Server Error 5xx' );
    is( $response->code,         500,         'Response Code' );
    is( $response->content_type, 'text/html', 'Response Content-Type' );
    is( $response->header('X-Catalyst-Action'),
        'engine/response/errors/one', 'Test Action' );
    like(
        $response->header('X-Catalyst-Error'),
        qr/^Caught exception/,
        'Catalyst Error'
    );
}

{
    ok( my $response = request('http://localhost/engine/response/errors/two'),
        'Request' );
    ok( $response->is_error, 'Response Server Error 5xx' );
    is( $response->code,         500,         'Response Code' );
    is( $response->content_type, 'text/html', 'Response Content-Type' );
    is( $response->header('X-Catalyst-Action'),
        'engine/response/errors/two', 'Test Action' );
    like(
        $response->header('X-Catalyst-Error'),
        qr/^Couldn't forward to/,
        'Catalyst Error'
    );
}

{
    ok( my $response = request('http://localhost/engine/response/errors/three'),
        'Request' );
    ok( $response->is_error, 'Response Server Error 5xx' );
    is( $response->code,         500,         'Response Code' );
    is( $response->content_type, 'text/html', 'Response Content-Type' );
    is(
        $response->header('X-Catalyst-Action'),
        'engine/response/errors/three',
        'Test Action'
    );
    like(
        $response->header('X-Catalyst-Error'),
        qr/I'm going to die!/,
        'Catalyst Error'
    );
}