forked from bricas/sru-perl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cgi.t
29 lines (22 loc) · 787 Bytes
/
cgi.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use warnings;
use Test::More qw( no_plan );
use CGI;
$ENV{ SCRIPT_NAME } = '/cgi-bin/sru.cgi';
$ENV{ SERVER_NAME } = 'www.inkdroid.org';
$ENV{ SCRIPT_FILENAME } = '/usr/local/inkdroid/apache/cgi-bin/sru.cgi';
$ENV{ QUERY_STRING } = 'operation=scan&version=1.1';
$ENV{ SERVER_PORT } = '80';
$ENV{ SERVER_PROTOCOL } = 'HTTP/1.1';
$ENV{ REQUEST_URI } = '/cgi-bin/sru.cgi?operation=scan&version=1.1';
$ENV{ HTTP_HOST } = 'www.inkdroid.org';
$ENV{ REQUEST_METHOD } = 'GET';
my $cgi = CGI->new();
isa_ok( $cgi, 'CGI', 'CGI mock object' );
use_ok( 'SRU::Request' );
ok( ! $SRU::Error, 'no error' );
my $request = SRU::Request->newFromCGI( $cgi );
ok( ! $SRU::Error, 'no error' );
isa_ok( $request, 'SRU::Request::Scan' );
is( $request->version(), '1.1', 'got version' );
1;