Merged 5.49_01 (r1339) from refactored branch to trunk
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / private.t
CommitLineData
dd4e6fd2 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
9770ad56 7use lib "$FindBin::Bin/../../../lib";
dd4e6fd2 8
c20bd9d9 9use Test::More tests => 24;
dd4e6fd2 10use Catalyst::Test 'TestApp';
11
12
13{
14 ok( my $response = request('http://localhost/action/private/one'), 'Request' );
15 ok( $response->is_success, 'Response Successful 2xx' );
16 is( $response->content_type, 'text/plain', 'Response Content-Type' );
17 is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
18 is( $response->content, 'access denied', 'Access' );
19}
20
21{
22 ok( my $response = request('http://localhost/action/private/two'), 'Request' );
23 ok( $response->is_success, 'Response Successful 2xx' );
24 is( $response->content_type, 'text/plain', 'Response Content-Type' );
25 is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
26 is( $response->content, 'access denied', 'Access' );
27}
28
29{
30 ok( my $response = request('http://localhost/three'), 'Request' );
ca27dee0 31 ok( $response->is_error, 'Response Server Error 5xx' );
32 is( $response->content_type, 'text/html', 'Response Content-Type' );
33 like( $response->header('X-Catalyst-Error'), qr/^Unknown resource "three"/, 'Catalyst Error' );
dd4e6fd2 34}
35
36{
37 ok( my $response = request('http://localhost/action/private/four'), 'Request' );
38 ok( $response->is_success, 'Response Successful 2xx' );
39 is( $response->content_type, 'text/plain', 'Response Content-Type' );
40 is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
41 is( $response->content, 'access denied', 'Access' );
42}
43
44{
45 ok( my $response = request('http://localhost/action/private/five'), 'Request' );
46 ok( $response->is_success, 'Response Successful 2xx' );
47 is( $response->content_type, 'text/plain', 'Response Content-Type' );
48 is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
49 is( $response->content, 'access denied', 'Access' );
50}