Backup-Duplicity-YADW
view release on metacpan or search on metacpan
t/10-methods.t view on Meta::CPAN
#!/usr/bin/perl
use Modern::Perl;
use warnings FATAL => 'all';
use Test::More;
use Backup::Duplicity::YADW;
use File::RandomGenerator;
use File::Path;
use Cwd;
use File::Copy;
use File::Basename;
use Data::Dumper;
use File::Which;
###### CONSTANTS ######
use constant TESTDIR => '/tmp/yadwtest';
###### GLOBAL VARS ######
use vars qw();
###### MAIN ######
system( 'rm -rf ' . TESTDIR );
if ( !which('duplicity') ) {
plan skip_all => 'unable to find duplicity on PATH';
}
my $y = method_test_backup();
method_test_verify($y);
method_test_restore($y);
method_test_expire($y);
method_test_status($y);
verify_pidfile_check();
$y = undef;
method_test_backup_bad();
done_testing();
###### END MAIN ######
END {
unless ( $ENV{DEBUG} ) {
system( 'rm -rf ' . TESTDIR );
}
}
sub method_test_status {
my $y = shift;
ok( $y->status );
}
sub method_test_restore {
my $y = shift;
my $file = find_rand_file();
unlink $file or die "failed to unlink $file: $!";
ok( $y->restore( location => $file ) );
( run in 1.996 second using v1.01-cache-2.11-cpan-140bd7fdf52 )