Fix naming problem with shippingServices, update tests.

This commit is contained in:
Colin Kuskie 2010-10-14 19:31:04 -07:00
parent 2edec772e5
commit 499feb420b
2 changed files with 16 additions and 25 deletions

View file

@ -89,7 +89,7 @@ property shipService => (
options => \&_shippingServices_options,
default => '03',
);
sub _shipService_options {
sub _shippingServices_options {
my $session = shift->session;
my $i18n = WebGUI::International->new($session, 'ShipDriver_UPS');
tie my %shippingServices, 'Tie::IxHash';

View file

@ -37,7 +37,7 @@ $session->user({user => $user});
#----------------------------------------------------------------------------
# Tests
plan tests => 36;
plan tests => 38;
#----------------------------------------------------------------------------
# put your tests here
@ -176,9 +176,8 @@ cmp_deeply(
'... checking error message',
);
my $properties = $driver->get();
$properties->{sourceZip} = '97123';
$driver->update($properties);
$driver->sourceZip(97123);
$driver->sourceCountry('');
eval { $driver->calculate() };
$e = Exception::Class->caught();
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no source country');
@ -190,9 +189,7 @@ cmp_deeply(
'... checking error message',
);
$properties = $driver->get();
$properties->{sourceCountry} = 'United States';
$driver->update($properties);
$driver->sourceCountry('US');
eval { $driver->calculate() };
$e = WebGUI::Error->caught();
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no userId');
@ -204,9 +201,7 @@ cmp_deeply(
'... checking error message',
);
$properties = $driver->get();
$properties->{userId} = 'Me';
$driver->update($properties);
$driver->userId('Me');
eval { $driver->calculate() };
$e = Exception::Class->caught();
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no password');
@ -218,9 +213,7 @@ cmp_deeply(
'... checking error message',
);
$properties = $driver->get();
$properties->{password} = 'knock knock';
$driver->update($properties);
$driver->password('knock knock');
eval { $driver->calculate() };
$e = Exception::Class->caught();
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no license number');
@ -328,17 +321,15 @@ if (! $license) {
$license = "bogey";
}
$properties = $driver->get();
$properties->{userId} = $userId;
$properties->{password} = $password;
$properties->{licenseNo} = $license;
$properties->{sourceZip} = '97123';
$properties->{sourceCountry} = 'United States';
$properties->{shipService} = '03';
$properties->{pickupType} = '01';
$properties->{customerClassification} = '04';
$properties->{residentialIndicator} = 'residential';
$driver->update($properties);
$driver->userId($userId);
$driver->password($password);
$driver->licenseNo($license);
$driver->sourceZip('97123');
$driver->sourceCountry('United States');
$driver->shipService('03');
$driver->pickupType('01');
$driver->customerClassification('04');
$driver->residentialIndicator('residential');
#$driver->testMode(1);