~ubuntu-branches/ubuntu/quantal/libhttp-request-ascgi-perl/quantal

« back to all changes in this revision

Viewing changes to t/05env.t

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Krzyzaniak (eloy)
  • Date: 2005-11-16 13:59:02 UTC
  • Revision ID: james.westby@ubuntu.com-20051116135902-mczwe8n9t4ynigrj
Tags: upstream-0.2
ImportĀ upstreamĀ versionĀ 0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl
 
2
 
 
3
use Test::More tests => 10;
 
4
 
 
5
use strict;
 
6
use warnings;
 
7
 
 
8
use HTTP::Request;
 
9
use HTTP::Request::AsCGI;
 
10
 
 
11
my $r = HTTP::Request->new( GET => 'http://www.host.com/cgi-bin/script.cgi/my/path/?a=1&b=2', [ 'X-Test' => 'Test' ] );
 
12
my %e = ( SCRIPT_NAME => '/cgi-bin/script.cgi' );
 
13
my $c = HTTP::Request::AsCGI->new( $r, %e );
 
14
$c->stdout(undef);
 
15
 
 
16
$c->setup;
 
17
 
 
18
is( $ENV{GATEWAY_INTERFACE}, 'CGI/1.1', 'GATEWAY_INTERFACE' );
 
19
is( $ENV{HTTP_HOST}, 'www.host.com:80', 'HTTP_HOST' );
 
20
is( $ENV{HTTP_X_TEST}, 'Test', 'HTTP_X_TEST' );
 
21
is( $ENV{PATH_INFO}, '/my/path/', 'PATH_INFO' );
 
22
is( $ENV{QUERY_STRING}, 'a=1&b=2', 'QUERY_STRING' );
 
23
is( $ENV{SCRIPT_NAME}, '/cgi-bin/script.cgi', 'SCRIPT_NAME' );
 
24
is( $ENV{REQUEST_METHOD}, 'GET', 'REQUEST_METHOD' );
 
25
is( $ENV{SERVER_NAME}, 'www.host.com', 'SERVER_NAME' );
 
26
is( $ENV{SERVER_PORT}, '80', 'SERVER_PORT' );
 
27
 
 
28
$c->restore;
 
29
 
 
30
is( $ENV{GATEWAY_INTERFACE}, undef, 'No CGI env after restore' );