Business-Shipping
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/210-USPS_Online-basic.t view on Meta::CPAN
#!/bin/env perl
# USPS_Online RateRequest suite of tests.
use strict;
use warnings;
use Test::More;
use Carp;
use Business::Shipping;
use Data::Dumper;
use Scalar::Util qw(blessed);
plan skip_all => 'Required modules not installed'
unless Business::Shipping::Config::calc_req_mod('USPS_Online');
plan skip_all => 'No credentials'
unless $ENV{USPS_USER_ID} and $ENV{USPS_PASSWORD};
plan skip_all => 'Slow tests. Set TEST_SLOW to run.'
unless $ENV{TEST_SLOW};
plan 'no_plan';
#goto letter_is_cheaper;
{
my $standard_method
= new Business::Shipping->rate_request(shipper => 'Online::USPS');
ok(defined $standard_method, 'USPS standard object construction');
my $other_method = new Business::Shipping::USPS_Online::RateRequest;
ok(defined $other_method, 'USPS alternate object construction');
my $package = new Business::Shipping::USPS_Online::Package;
ok(defined $package, 'USPS package object construction');
}
{
my $shipment = Business::Shipping::USPS_Online::Shipment->new();
is( blessed($shipment),
'Business::Shipping::USPS_Online::Shipment',
'Business::Shipping::USPS_Online::Shipment created successfully'
);
$shipment->to_zip('98683');
is($shipment->to_zip(), '98683', 'Shipment: set and get zip code.');
}
{
my $rate_request = Business::Shipping->rate_request(
shipper => 'USPS_Online',
service => 'Priority',
from_zip => '98683',
to_zip => '98270',
weight => 5.00,
);
is($rate_request->to_zip(), '98270',
'rate_request() to set, then get zip code.');
}
{
my $rate_request = Business::Shipping->rate_request(
shipper => 'USPS_Online',
'service' => 'Priority Mail International',
'weight' => 1,
'ounces' => 0,
'mail_type' => 'Package',
'to_country' => 'Great Britain',
'from_zip' => '98682',
);
#is($rate_request->to_country(), 'Great Britain',
# 'rate_request() to set, then get to_country.');
ok(1, 'do nothing');
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.934 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )