mirror of
https://github.com/vrag86/Mediafire-Api
synced 2026-01-13 13:24:28 -08:00
Added dowmloadFile() method
This commit is contained in:
17
t/001_test.t
17
t/001_test.t
@@ -35,6 +35,7 @@ use_ok('Mediafire::Api');
|
||||
my $LOGIN = $ENV{MEDIAFIRE_LOGIN};
|
||||
my $PASSWORD = $ENV{MEDIAFIRE_PASSWORD};
|
||||
my $UPLOAD_FILE = File::Spec->catfile($CURR_DIR, 't', 'test_upload3.f');
|
||||
my $DEST_DOWNLOAD_FILE = File::Spec->catfile($CURR_DIR, 't', 'downloaded_test_upload3.f');
|
||||
|
||||
|
||||
SKIP: {
|
||||
@@ -53,8 +54,9 @@ SKIP: {
|
||||
skip $@;
|
||||
}
|
||||
|
||||
testUploadFile($mediafire, $UPLOAD_FILE);
|
||||
my $mediafire_file = testUploadFile($mediafire, $UPLOAD_FILE);
|
||||
testFindFileByName($mediafire, basename($UPLOAD_FILE));
|
||||
testDownloadFile($mediafire, $mediafire_file, $DEST_DOWNLOAD_FILE);
|
||||
|
||||
};
|
||||
|
||||
@@ -80,6 +82,7 @@ sub testUploadFile {
|
||||
|
||||
my $doupload_key = $upload_file->key;
|
||||
ok($doupload_key, "Test upload file. DouploadKey: $doupload_key");
|
||||
return $upload_file;
|
||||
}
|
||||
|
||||
sub testFindFileByName {
|
||||
@@ -94,4 +97,16 @@ sub testFindFileByName {
|
||||
|
||||
}
|
||||
|
||||
sub testDownloadFile {
|
||||
my ($mediafire, $mediafire_file, $dest_file) = @_;
|
||||
|
||||
unlink($dest_file);
|
||||
$mediafire->downloadFile(
|
||||
-mediafire_file => $mediafire_file,
|
||||
-dest_file => $dest_file,
|
||||
);
|
||||
|
||||
ok (-f $dest_file, 'Test downloadFile()');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user