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