API-ISPManager

 view release on metacpan or  search on metacpan

t/01-test.t  view on Meta::CPAN

### Stats end

#exit;

no warnings 'once';

$API::ISPManager::DEBUG = 0;


### ONLINE TESTS
exit if !$ONLINE;

$a = 'get_auth_id';
is( get_auth_id(
        username => 'root',
        password => 'qwerty',
        host     => $test_host,
        path     => 'manager',
    ), 
    '',
    "$a with error password"
);

my $auth_id;

like( $auth_id = get_auth_id(
        username => $ENV{username} || 'root',
        password => $ENV{password},
        host     => $test_host,
        path     => 'manager',
    ), 
    qr/\d+/,
    "$a with correct password ($auth_id)"
);

=head

is(
    scalar keys %{ API::ISPManager::user::list( { %correct_params } )->{elem} },
    20,
    'user::list test' 
);

=cut

my $ip_list = API::ISPManager::ip::list( { %correct_params } );

diag "Get ips from panel: " . Dumper( $ip_list );

if ($ip_list && ref $ip_list eq 'ARRAY' && scalar @$ip_list) {
    my $ip  = $ip_list->[0];
    
    if ($ip) {
        diag $ip;

        diag Dumper( API::ISPManager::user::create( {
            %correct_params,
            name      => 'nrgxxxxxapi',
            passwd    => 'qwerty',
            ip        => $ip, 
            preset    => 'Host-1',
            domain    => 'nrg.name',
        } ) );

        diag Dumper( API::ISPManager::ftp::list( {
            %correct_params,
            authinfo => 'username:password',
            su       => 'su_as_username',
        } ) );

    
        diag Dumper( API::ISPManager::user::disable( {
            %correct_params,
            elid      => 'nrgxxxxxapi',
        } ) );


        diag Dumper( API::ISPManager::user::enable( {
            %correct_params,
            elid      => 'nrgxxxxxapi',
        } ) );

        diag Dumper( API::ISPManager::user::delete( {
            %correct_params,
            elid      => 'nrgxxxxxapi',
        } ) );

    }
}

# warn Dumper( API::ISPManager::domain::list( { %correct_params } ) );




( run in 0.967 second using v1.01-cache-2.11-cpan-39bf76dae61 )