X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05env.t;h=bbb7125c46c633c7cac8c206d5223695af77c143;hb=9c216915d12ea486f286186438c98593c2a3c60b;hp=209d61e62d4271a59373fb527080dbe1346e62a3;hpb=14f243e8c78199aad82785aa32f2f3e5409d9a9b;p=catagits%2FHTTP-Request-AsCGI.git diff --git a/t/05env.t b/t/05env.t index 209d61e..bbb7125 100644 --- a/t/05env.t +++ b/t/05env.t @@ -1,6 +1,6 @@ #!perl -use Test::More tests => 10; +use Test::More tests => 12; use strict; use warnings; @@ -9,9 +9,13 @@ use HTTP::Request; use HTTP::Request::AsCGI; my $r = HTTP::Request->new( GET => 'http://www.host.com/cgi-bin/script.cgi/my/path/?a=1&b=2', [ 'X-Test' => 'Test' ] ); -my %e = ( SCRIPT_NAME => '/cgi-bin/script.cgi' ); -my $c = HTTP::Request::AsCGI->new( $r, %e ); -$c->stdout(undef); + $r->authorization_basic( 'chansen', 'xxx' ); + +my $c = HTTP::Request::AsCGI->new( + environment => { SCRIPT_NAME => '/cgi-bin/script.cgi' }, + request => $r, + stdout => undef +); $c->setup; @@ -20,6 +24,8 @@ is( $ENV{HTTP_HOST}, 'www.host.com:80', 'HTTP_HOST' ); is( $ENV{HTTP_X_TEST}, 'Test', 'HTTP_X_TEST' ); is( $ENV{PATH_INFO}, '/my/path/', 'PATH_INFO' ); is( $ENV{QUERY_STRING}, 'a=1&b=2', 'QUERY_STRING' ); +is( $ENV{AUTH_TYPE}, 'Basic', 'AUTH_TYPE' ); +is( $ENV{REMOTE_USER}, 'chansen', 'REMOTE_USER' ); is( $ENV{SCRIPT_NAME}, '/cgi-bin/script.cgi', 'SCRIPT_NAME' ); is( $ENV{REQUEST_METHOD}, 'GET', 'REQUEST_METHOD' ); is( $ENV{SERVER_NAME}, 'www.host.com', 'SERVER_NAME' );