Added some stress testing
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / private.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/../../../lib";
8
9 use Test::More tests => 240;
10 use Catalyst::Test 'TestApp';
11
12 for ( 1 .. 10 ) {
13     {
14         ok( my $response = request('http://localhost/action/private/one'),
15             'Request' );
16         ok( $response->is_success, 'Response Successful 2xx' );
17         is( $response->content_type, 'text/plain', 'Response Content-Type' );
18         is(
19             $response->header('X-Test-Class'),
20             'TestApp::Controller::Action::Private',
21             'Test Class'
22         );
23         is( $response->content, 'access denied', 'Access' );
24     }
25
26     {
27         ok( my $response = request('http://localhost/action/private/two'),
28             'Request' );
29         ok( $response->is_success, 'Response Successful 2xx' );
30         is( $response->content_type, 'text/plain', 'Response Content-Type' );
31         is(
32             $response->header('X-Test-Class'),
33             'TestApp::Controller::Action::Private',
34             'Test Class'
35         );
36         is( $response->content, 'access denied', 'Access' );
37     }
38
39     {
40         ok( my $response = request('http://localhost/three'), 'Request' );
41         ok( $response->is_error, 'Response Server Error 5xx' );
42         is( $response->content_type, 'text/html', 'Response Content-Type' );
43         like(
44             $response->header('X-Catalyst-Error'),
45             qr/^Unknown resource "three"/,
46             'Catalyst Error'
47         );
48     }
49
50     {
51         ok( my $response = request('http://localhost/action/private/four'),
52             'Request' );
53         ok( $response->is_success, 'Response Successful 2xx' );
54         is( $response->content_type, 'text/plain', 'Response Content-Type' );
55         is(
56             $response->header('X-Test-Class'),
57             'TestApp::Controller::Action::Private',
58             'Test Class'
59         );
60         is( $response->content, 'access denied', 'Access' );
61     }
62
63     {
64         ok( my $response = request('http://localhost/action/private/five'),
65             'Request' );
66         ok( $response->is_success, 'Response Successful 2xx' );
67         is( $response->content_type, 'text/plain', 'Response Content-Type' );
68         is(
69             $response->header('X-Test-Class'),
70             'TestApp::Controller::Action::Private',
71             'Test Class'
72         );
73         is( $response->content, 'access denied', 'Access' );
74     }
75 }