API-PleskExpand
view release on metacpan or search on metacpan
use strict;
use warnings;
use Carp;
use Test::More;
use Test::LongString;
use Data::Dumper;
use lib 't';
use TestData;
BEGIN {
plan tests => $ENV{online_stress_tests} ? 34 : 28;
use_ok( 'API::PleskExpand' );
use_ok( 'API::PleskExpand::Accounts' );
use_ok( 'API::PleskExpand::Domains' );
use_ok( 'API::Plesk::Response');
}
my $expand_client = API::PleskExpand->new( %TestData::online_expand_valid_params);
isa_ok( $expand_client, 'API::PleskExpand', 'STATIC call new' );
# Calling undefined method from Plesk.pm
{
our $our_warning;
local $SIG{__DIE__} = sub { $our_warning = shift; }; # confess <=> die
eval { API::PleskExpand->new(%TestData::online_expand_valid_params)->aaa__bbbccc() };
like($our_warning, qr/aaa__bbbccc/,
'Checking AUTOLOAD by calling undefined method.');
}
my %create_account_data = (
'select' => 'optimal',
'template-id' => 1,
'general_info' => {
login => 'suxdffffxx',
pname => 'stdsdffafff',
passwd => '1234d5678',
status => 0,
cname => '',
phone => '',
fax => '',
email => '',
address => '',
city => '',
state => '',
pcode => '',
country => 'RU',
}
);
my $create_request = API::PleskExpand::Accounts::create( %create_account_data );
is_string($create_request, $_, 'create account test') for
'<add_use_template><gen_info><address></address><city></city><cname></cname>' .
'<country>RU</country><email></email><fax></fax><login>suxdffffxx</login>' .
'<passwd>1234d5678</passwd><pcode></pcode><phone></phone><pname>stdsdffafff</pname>' .
'<state></state><status>0</status></gen_info><!-- create_client -->' .
'<tmpl_id>1</tmpl_id><server_auto><optimal></optimal></server_auto></add_use_template>';
$create_request = API::PleskExpand::Accounts::create(
%create_account_data,
'attach_to_template' => 1
);
( run in 0.657 second using v1.01-cache-2.11-cpan-39bf76dae61 )