Fix naming problem with shippingServices, update tests.
This commit is contained in:
parent
2edec772e5
commit
499feb420b
2 changed files with 16 additions and 25 deletions
|
|
@ -89,7 +89,7 @@ property shipService => (
|
||||||
options => \&_shippingServices_options,
|
options => \&_shippingServices_options,
|
||||||
default => '03',
|
default => '03',
|
||||||
);
|
);
|
||||||
sub _shipService_options {
|
sub _shippingServices_options {
|
||||||
my $session = shift->session;
|
my $session = shift->session;
|
||||||
my $i18n = WebGUI::International->new($session, 'ShipDriver_UPS');
|
my $i18n = WebGUI::International->new($session, 'ShipDriver_UPS');
|
||||||
tie my %shippingServices, 'Tie::IxHash';
|
tie my %shippingServices, 'Tie::IxHash';
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ $session->user({user => $user});
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
plan tests => 36;
|
plan tests => 38;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# put your tests here
|
# put your tests here
|
||||||
|
|
@ -176,9 +176,8 @@ cmp_deeply(
|
||||||
'... checking error message',
|
'... checking error message',
|
||||||
);
|
);
|
||||||
|
|
||||||
my $properties = $driver->get();
|
$driver->sourceZip(97123);
|
||||||
$properties->{sourceZip} = '97123';
|
$driver->sourceCountry('');
|
||||||
$driver->update($properties);
|
|
||||||
eval { $driver->calculate() };
|
eval { $driver->calculate() };
|
||||||
$e = Exception::Class->caught();
|
$e = Exception::Class->caught();
|
||||||
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no source country');
|
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no source country');
|
||||||
|
|
@ -190,9 +189,7 @@ cmp_deeply(
|
||||||
'... checking error message',
|
'... checking error message',
|
||||||
);
|
);
|
||||||
|
|
||||||
$properties = $driver->get();
|
$driver->sourceCountry('US');
|
||||||
$properties->{sourceCountry} = 'United States';
|
|
||||||
$driver->update($properties);
|
|
||||||
eval { $driver->calculate() };
|
eval { $driver->calculate() };
|
||||||
$e = WebGUI::Error->caught();
|
$e = WebGUI::Error->caught();
|
||||||
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no userId');
|
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no userId');
|
||||||
|
|
@ -204,9 +201,7 @@ cmp_deeply(
|
||||||
'... checking error message',
|
'... checking error message',
|
||||||
);
|
);
|
||||||
|
|
||||||
$properties = $driver->get();
|
$driver->userId('Me');
|
||||||
$properties->{userId} = 'Me';
|
|
||||||
$driver->update($properties);
|
|
||||||
eval { $driver->calculate() };
|
eval { $driver->calculate() };
|
||||||
$e = Exception::Class->caught();
|
$e = Exception::Class->caught();
|
||||||
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no password');
|
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no password');
|
||||||
|
|
@ -218,9 +213,7 @@ cmp_deeply(
|
||||||
'... checking error message',
|
'... checking error message',
|
||||||
);
|
);
|
||||||
|
|
||||||
$properties = $driver->get();
|
$driver->password('knock knock');
|
||||||
$properties->{password} = 'knock knock';
|
|
||||||
$driver->update($properties);
|
|
||||||
eval { $driver->calculate() };
|
eval { $driver->calculate() };
|
||||||
$e = Exception::Class->caught();
|
$e = Exception::Class->caught();
|
||||||
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no license number');
|
isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no license number');
|
||||||
|
|
@ -328,17 +321,15 @@ if (! $license) {
|
||||||
$license = "bogey";
|
$license = "bogey";
|
||||||
}
|
}
|
||||||
|
|
||||||
$properties = $driver->get();
|
$driver->userId($userId);
|
||||||
$properties->{userId} = $userId;
|
$driver->password($password);
|
||||||
$properties->{password} = $password;
|
$driver->licenseNo($license);
|
||||||
$properties->{licenseNo} = $license;
|
$driver->sourceZip('97123');
|
||||||
$properties->{sourceZip} = '97123';
|
$driver->sourceCountry('United States');
|
||||||
$properties->{sourceCountry} = 'United States';
|
$driver->shipService('03');
|
||||||
$properties->{shipService} = '03';
|
$driver->pickupType('01');
|
||||||
$properties->{pickupType} = '01';
|
$driver->customerClassification('04');
|
||||||
$properties->{customerClassification} = '04';
|
$driver->residentialIndicator('residential');
|
||||||
$properties->{residentialIndicator} = 'residential';
|
|
||||||
$driver->update($properties);
|
|
||||||
|
|
||||||
#$driver->testMode(1);
|
#$driver->testMode(1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue