API-ISPManager
view release on metacpan or search on metacpan
t/02-files.t view on Meta::CPAN
plid => '',
} );
my $file_copy = API::ISPManager::file::copy( {
%connection_params,
elid => "$now.test",
plid => "$now",
} );
@expected_file_list = ("$now.test");
@real_file_list = get_file_list('', $now);
ok(union_equal(\@expected_file_list, \@real_file_list), 'file copy');
API::ISPManager::file::delete( {
%connection_params,
elid => "$now.test",
plid => '',
} );
API::ISPManager::file::delete( {
%connection_params,
elid => "$now",
plid => '',
} );
# Ïåðåìåùåíèå ôàéëà
$now = time;
API::ISPManager::file::create( {
%connection_params,
filetype => 0,
name => "$now.test",
plid => '',
} );
API::ISPManager::file::create( {
%connection_params,
filetype => 1,
name => "$now",
plid => '',
} );
my $file_move = API::ISPManager::file::move( {
%connection_params,
elid => "$now.test",
plid => "$now",
} );
@expected_file_list = ("$now.test");
@real_file_list = get_file_list('', $now);
ok(union_equal(\@expected_file_list, \@real_file_list), 'file move');
API::ISPManager::file::delete( {
%connection_params,
elid => "$now",
plid => '',
} );
# Çàãðóçêà ôàéëà
$now = time;
open my $fh, '>', $now or die "Can't open $now for writing: $!";
print {$fh} 'hello world';
close $fh;
my $upload_result = API::ISPManager::file::upload( {
%connection_params,
plid => '',
file => $now,
} );
@expected_file_list = @original_file_list;
push @expected_file_list, $now;
@real_file_list = get_file_list('', '');
ok(union_equal(\@expected_file_list, \@real_file_list), 'file upload');
API::ISPManager::file::delete( {
%connection_params,
elid => "$now",
plid => '',
} );
# Ðàñïàêîâêà àðõèâà
`tar -czf $now.tar.gz $now`;
API::ISPManager::file::upload( {
%connection_params,
plid => '',
file => "$now.tar.gz",
} );
my $extract_result = API::ISPManager::file::extract( {
%connection_params,
plid => '',
elid => "$now.tar.gz",
} );
@expected_file_list = @original_file_list;
push @expected_file_list, $now;
push @expected_file_list, "$now.tar.gz";
@real_file_list = get_file_list('', '');
ok(union_equal(\@expected_file_list, \@real_file_list), 'file extract');
API::ISPManager::file::delete( {
%connection_params,
elid => "$now",
plid => '',
} );
API::ISPManager::file::delete( {
%connection_params,
elid => "$now.tar.gz",
plid => '',
} );
unlink $now;
unlink "$now.tar.gz";
# Ïîëó÷åíèå ñïèñêà ôàéëîâ â âèäå ìàññèâà
sub get_file_list {
my ($plid, $elid) = @_;
my $answer = API::ISPManager::file::list( {
%connection_params,
plid => $plid,
( run in 0.712 second using v1.01-cache-2.11-cpan-39bf76dae61 )