aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-07-03 23:55:54 +0200
committerAngelo Naselli <anaselli@linux.it>2015-07-03 23:55:54 +0200
commit8dc0a0866387fc197fd00579bff1367f21422d14 (patch)
treee9f1f7614bbf7b9944e50daacfe7938726d1771d /t
parent9ab21363fe366594d904f01b254f0228335ec9c7 (diff)
downloadmanatools-8dc0a0866387fc197fd00579bff1367f21422d14.tar
manatools-8dc0a0866387fc197fd00579bff1367f21422d14.tar.gz
manatools-8dc0a0866387fc197fd00579bff1367f21422d14.tar.bz2
manatools-8dc0a0866387fc197fd00579bff1367f21422d14.tar.xz
manatools-8dc0a0866387fc197fd00579bff1367f21422d14.zip
Added tools to urpmi backend
Diffstat (limited to 't')
-rw-r--r--t/09-Shared-urpmi_backend.t40
1 files changed, 35 insertions, 5 deletions
diff --git a/t/09-Shared-urpmi_backend.t b/t/09-Shared-urpmi_backend.t
index c5501b41..55317cf3 100644
--- a/t/09-Shared-urpmi_backend.t
+++ b/t/09-Shared-urpmi_backend.t
@@ -3,12 +3,16 @@ use strict;
use warnings FATAL => 'all';
use Test::More;
use Data::Dumper;
+use URPM;
BEGIN {
use_ok( 'ManaTools::Shared::urpmi_backend::DB' ) || print "ManaTools::Shared::urpmi_backend::DB failed!\n";
+ use_ok( 'ManaTools::Shared::urpmi_backend::tools' ) || print "ManaTools::Shared::urpmi_backend::tools failed!\n";
}
-ok ( my $obj = ManaTools::Shared::urpmi_backend::DB->new(), 'new');
+diag "******* ManaTools::Shared::urpmi_backend::DB *******";
+
+ok ( my $obj = ManaTools::Shared::urpmi_backend::DB->new(), 'new_DB');
is ( ref($obj->open_rpm_db()), 'URPM::DB', 'open_rpm_db');
my $urpm = $obj->open_urpmi_db();
is ( ref($urpm), 'urpm', 'open_urpmi_db');
@@ -19,14 +23,40 @@ is ( ref($urpm), 'urpm', 'fast_open_urpmi_db');
is ( $obj->lock($urpm), 1, 'lock(locked)');
is ( $obj->unlock($urpm), undef, 'unlock');
+diag "******* ManaTools::Shared::urpmi_backend::tools *******";
+
+ok ( my $tool = ManaTools::Shared::urpmi_backend::tools->new(), 'new_tools');
+is ( ref($tool->urpmi_db_backend()), 'ManaTools::Shared::urpmi_backend::DB', 'urpmi_db_backend');
+ok (my $resp = $tool->get_update_medias($urpm), 'get_update_medias from tools');
+diag "\tfound < " . $resp . " > backport media";
+ok ( $tool->is_package_installed('rpm'), 'is_package_installed(rpm)');
+ok ( my $fullname = $tool->find_installed_fullname('urpmi'), 'find_installed_fullname');
+diag "\turpmi installed package is < " . $fullname . " > ";
+ok ( $resp = ($tool->is_mageia() ? "yes" : "no"), 'is_mageia');
+diag "\tIs the system mageia? < " . $resp . " > ";
+ok ( $resp = $tool->vendor(), 'vendor' );
+diag "\tThe vendor is < " . $resp . " > ";
+
+$urpm = $obj->open_urpmi_db();
-ok ( my $resp = ($obj->is_it_a_devel_distro() ? 'yes' : 'no'), 'is_it_a_devel_distro');
+ok ( $resp = $tool->fullname_to_package_id($fullname), 'fullname_to_package_id' );
+ok ( my $pkg = $tool->get_package_by_package_id($urpm, $resp), 'get_package_by_package_id' );
+is ($fullname, $pkg->fullname, 'fullname eq pkg->fullname' );
+ok ( $resp = $tool->pkg2medium($pkg, $urpm), 'pkg2medium' );
+diag "\tThe medium is < " . $resp->{name} . " > ";
+ok ( $resp = $tool->get_installed_fullname_pkid($pkg), 'get_installed_fullname' );
+diag "\tThe package_id is < " . $resp . " > ";
+
+
+ok ( $resp = ($obj->is_it_a_devel_distro() ? 'yes' : 'no'), 'is_it_a_devel_distro');
diag "\tis_it_a_devel_distro? < " . $resp . " >";
-ok ( $resp = $obj->get_backport_media($urpm), 'get_backport_media');
+ok ( $resp = $obj->get_backport_media($urpm) || 'none', 'get_backport_media');
diag "\tfound < " . $resp . " > backport media";
-ok ( $resp = $obj->get_inactive_backport_media($urpm), 'get_inactive_backport_media');
+ok ( $resp = $obj->get_inactive_backport_media($urpm) || 'none', 'get_inactive_backport_media');
diag "\tfound < " . $resp . " > inactive backport media";
-ok ( $resp = $obj->get_update_medias($urpm), 'get_update_medias');
+ok ( $resp = $obj->get_update_medias($urpm) || 'none', 'get_update_medias');
diag "\tfound < " . $resp . " > update media";
+
+
done_testing;