sub
from_config {
or
do
{
plan(
skip_all
=>
'this test only runs with IO::Async and Net::Async::HTTP'
);
exit
(0);
};
my
$loop
= IO::Async::Loop->new;
my
$ups
= Net::Async::Webservice::UPS->new({
config_file
=> Test::Net::Async::Webservice::UPS->conf_file,
loop
=>
$loop
,
});
return
(
$ups
,
$loop
);
}
sub
from_config_sync {
or
do
{
plan(
skip_all
=>
'this test only runs with LWP::UserAgent'
);
exit
(0);
};
my
$ua
= LWP::UserAgent->new;
my
$ups
= Net::Async::Webservice::UPS->new({
config_file
=> Test::Net::Async::Webservice::UPS->conf_file,
user_agent
=>
$ua
,
});
return
(
$ups
,
$ua
);
}
sub
from_config_tracing {
or
do
{
plan(
skip_all
=>
'this test only runs with IO::Async and Net::Async::HTTP'
);
exit
(0);
};
my
$loop
= IO::Async::Loop->new;
my
$ua
= Test::Net::Async::Webservice::UPS::Tracing->new({
loop
=>
$loop
});
my
$ups
= Net::Async::Webservice::UPS->new({
config_file
=> Test::Net::Async::Webservice::UPS->conf_file,
user_agent
=>
$ua
,
});
return
(
$ups
,
$ua
);
}
sub
without_network {
my
(
$args
) =
@_
;
my
$ua
= Test::Net::Async::Webservice::UPS::NoNetwork->new();
my
$ret
= Net::Async::Webservice::UPS->new({
user_id
=>
'testid'
,
password
=>
'testpass'
,
access_key
=>
'testkey'
,
user_agent
=>
$ua
,
%{
$args
//{}},
});
return
(
$ret
,
$ua
);
}
1;