Commit | Line | Data |
8026359e |
1 | #!perl |
2 | |
3 | # This tests to make sure the REMOTE_USER environment variable is properly passed through by the engine. |
4 | |
5 | use strict; |
6 | use warnings; |
7 | |
8 | use FindBin; |
9 | use lib "$FindBin::Bin/../lib"; |
10 | |
11 | use Test::More tests => 7; |
12 | use Catalyst::Test 'TestApp'; |
13 | |
14 | use Catalyst::Request; |
15 | use HTTP::Request::Common; |
16 | |
17 | { |
18 | my $creq; |
19 | |
20 | local $ENV{REMOTE_USER} = 'dwc'; |
21 | my $request = GET( |
22 | 'http://localhost/dump/request', |
23 | ); |
24 | |
25 | ok( my $response = request($request), 'Request' ); |
26 | ok( $response->is_success, 'Response Successful 2xx' ); |
27 | is( $response->content_type, 'text/plain', 'Response Content-Type' ); |
28 | like( $response->content, qr/'Catalyst::Request'/, |
29 | 'Content is a serialized Catalyst::Request' ); |
30 | |
31 | { |
32 | no strict 'refs'; |
33 | ok( |
34 | eval '$creq = ' . $response->content, |
35 | 'Unserialize Catalyst::Request' |
36 | ); |
37 | } |
38 | |
39 | isa_ok( $creq, 'Catalyst::Request' ); |
81f25ce6 |
40 | SKIP: |
41 | { |
42 | if ( $ENV{CATALYST_SERVER} ) { |
43 | skip 'Using remote server', 1; |
44 | } |
45 | is( $creq->remote_user, 'dwc', '$c->req->remote_user ok' ); |
46 | } |
8026359e |
47 | } |