App-Fetchware
view release on metacpan or search on metacpan
t/App-FetchwareX-HTMLPageSync.t view on Meta::CPAN
subtest 'test HTMLPageSync uninstall()' => sub {
skip_all_unless_release_testing();
# Will delete destination_directory, but the destination_directory is a
# tempdir(), so it will be delete anyway.
# Just ignore the warning File::Temp prints, because I deleted its tempdir()
# instead of it doing it itself.
ok(uninstall(cwd()),
'checked uninstall() success');
ok(! -e $dest_dir,
'checked uninstall() tempdir removal');
# Test uninstall()s exceptions.
eval_ok(sub {uninstall("$$-@{[int(rand(383889))]}")},
qr/App-FetchwareX-HTMLPageSync: Failed to uninstall the specified package and specifically/,
'checked uninstall() $build_path exception');
};
subtest 'test uninstall() keep_destination_directory' => sub {
skip_all_unless_release_testing();
# Create another tempdir, because the previous uninstall() deleted it.
my $tempdir = tempdir("fetchware-$$-XXXXXXXXXX", TMPDIR => 1, CLEANUP => 1);
ok(-e $tempdir,
'checked lookup() temporary destination directory creation');
# Use new destination_directory.
config_replace(destination_directory => $tempdir);
# Install HTMLPageSync again to test keep_destination_directory.
my $wallpaper_urls = lookup();
note explain $wallpaper_urls;
debug_CONFIG();
cmp_deeply(
$wallpaper_urls,
array_each(any(
re(qr/Announcement2.\d.(html|txt)/),
re(qr/CHANGES_2\.\d(\.\d+)?/),
re(qr/CURRENT(-|_)IS(-|_)\d\.\d+?\.\d+/),
re(qr/
HEADER.html
|
KEYS
|
README.html
|
binaries
|
docs
|
flood
/x),
re(qr/httpd-2\.\d\.\d+?-win32-src\.zip(\.asc)?/),
re(qr/httpd-2\.\d\.\d+?\.tar\.(bz2|gz)(\.asc)?/),
re(qr/httpd-2\.\d\.\d+?-deps\.tar\.(bz2|gz)(\.asc)?/),
re(qr/
libapreq
|
mod_fcgid
|
mod_ftp
|
patches
/x),
re(qr/\d{12}/)
) # end any
),
'checked lookup()s return value for acceptable values.'
);
$download_file_paths = download($tempdir, $wallpaper_urls);
# Transform the gotten url basenames with the expected url basenames to
# determine if everything was downloaded properly.
note "HERE";
note explain $download_file_paths;
my $download_file_path_basenames
=
map {$_ = file($_)->basename()} @$download_file_paths;
note explain $download_file_path_basenames;
my $wallpaper_url_basenames
=
map {$_ = file($_)->basename()} @$wallpaper_urls;
cmp_deeply(
$download_file_path_basenames,
$wallpaper_url_basenames,
'checked download()s return value for acceptable values.'
);
ok(install($download_file_paths),
'checked install() success');
# Test uninstall's keep_destination_directory option.
keep_destination_directory 'True';
ok(uninstall(cwd()),
'checked uninstall() success');
# $tempdir should still exist. Don't clean it up, because the uninstall()
# subtest below will do that for me.
ok( -e $tempdir,
'checked uninstall() tempdir removal');
};
###BUGALERT### Create a customizable version of make_test_dist() to create a
#user testable version of this module.
subtest 'test HTMLPageSync end()' => sub {
skip_all_unless_release_testing();
end();
# Use Test::Fetchware's end_ok() to test if end did it's job correctly.
end_ok($temp_dir);
};
SKIP: {
( run in 0.530 second using v1.01-cache-2.11-cpan-5735350b133 )