The current USPS driver only works on domestic shipments.

This commit is contained in:
Colin Kuskie 2009-11-05 08:18:10 -08:00
parent 40cec4b855
commit c871c0372d
3 changed files with 24 additions and 5 deletions

View file

@ -23,10 +23,9 @@ use Data::Dumper;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
use WebGUI::Shop::ShipDriver::USPS;
plan tests => 65;
use_ok('WebGUI::Shop::ShipDriver::USPS')
or die 'Unable to load module WebGUI::Shop::ShipDriver::USPS';
#----------------------------------------------------------------------------
# Init
@ -224,14 +223,14 @@ my $workAddress = $addressBook->addAddress({
organization => 'Plain Black Corporation',
address1 => '1360 Regent St. #145',
city => 'Madison', state => 'WI', code => '53715',
country => 'USA',
country => 'United States',
});
my $wucAddress = $addressBook->addAddress({
label => 'wuc',
organization => 'Madison Concourse Hotel',
address1 => '1 W Dayton St',
city => 'Madison', state => 'WI', code => '53703',
country => 'USA',
country => 'United States',
});
$cart->update({shippingAddressId => $workAddress->getId});
@ -838,6 +837,19 @@ isa_ok($e, 'WebGUI::Error::Shop::RemoteShippingRate', 'calculate throws an excep
$properties->{userId} = $userId;
$driver->update($properties);
my $dutchAddress = $addressBook->addAddress({
label => 'dutch',
address1 => 'Rotterdamseweg 183C',
city => 'Delft', code => '2629HD',
country => 'Netherlands',
});
$cart->update({shippingAddressId => $dutchAddress->getId});
$cost = eval { $driver->calculate($cart); };
$e = Exception::Class->caught();
isa_ok($e, 'WebGUI::Error::InvalidParam', "calculate won't calculate for foreign countries");
$cart->update({shippingAddressId => $workAddress->getId});
#######################################################################
#
# _calculateInsurance edge case