bunch of basic HTTP tests
This commit is contained in:
parent
ab502e84d8
commit
88ef9a412e
1 changed files with 56 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $num_tests = 6;
|
||||
my $num_tests = 14;
|
||||
|
||||
plan tests => $num_tests;
|
||||
|
||||
|
|
@ -29,6 +29,12 @@ my $http = $session->http;
|
|||
|
||||
isa_ok($http, 'WebGUI::Session::Http', 'session has correct object type');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# setStatus, getStatus, getStatusDescription
|
||||
#
|
||||
####################################################
|
||||
|
||||
$http->setStatus('123');
|
||||
|
||||
is($http->getStatus, '123', 'getStatus: returns correct code');
|
||||
|
|
@ -43,5 +49,54 @@ $http->setStatus('', 'packets are great');
|
|||
|
||||
is($http->getStatusDescription, 'packets are great', 'getStatusDescription: returns correct description');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# isRedirect
|
||||
#
|
||||
####################################################
|
||||
|
||||
$http->setStatus('200');
|
||||
is($http->isRedirect, '', 'isRedirect: is not');
|
||||
|
||||
$http->setStatus('302');
|
||||
is($http->isRedirect, 1, 'isRedirect: is too');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# setMimeType, getMimeType
|
||||
#
|
||||
####################################################
|
||||
|
||||
$http->setMimeType('');
|
||||
is($http->getMimeType, 'text/html', 'set/get MimeType: default is text/html');
|
||||
|
||||
$http->setMimeType('image/jpeg');
|
||||
is($http->getMimeType, 'image/jpeg', 'set/get MimeType: set specific type and get it');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# setStreamedFile, getStreamedFile
|
||||
#
|
||||
####################################################
|
||||
|
||||
$http->setStreamedFile('');
|
||||
is($http->getStreamedFile, undef, 'set/get StreamedFile: false values return undef, empty string');
|
||||
$http->setStreamedFile(0);
|
||||
is($http->getStreamedFile, undef, 'set/get StreamedFile: false values return undef, empty string');
|
||||
|
||||
$http->setStreamedFile('/home/streaming');
|
||||
is($http->getStreamedFile, '/home/streaming', 'set/get StreamedFile: set specific location and get it');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# setNoHeader and sendHeader
|
||||
#
|
||||
####################################################
|
||||
|
||||
$http->setNoHeader(1);
|
||||
is($http->sendHeader, undef, 'sendHeader returns undef when setNoHeader is true');
|
||||
|
||||
$http->setNoHeader(0);
|
||||
|
||||
END {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue