From 83cf11436eb20a9278b79ec9f02f1503b4f7b4ba Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Mon, 29 Jul 2013 12:52:14 +0200 Subject: removed test for enumeration of software identities EnumInstance(Names)s call is not supported for software identities, let's not test it. --- src/software/test/test_software_identity.py | 38 ----------------------------- 1 file changed, 38 deletions(-) diff --git a/src/software/test/test_software_identity.py b/src/software/test/test_software_identity.py index 47eee28..ea60afe 100755 --- a/src/software/test/test_software_identity.py +++ b/src/software/test/test_software_identity.py @@ -106,44 +106,6 @@ class TestSoftwareIdentity(base.SoftwareBaseTestCase): #pylint: disable=R0904 InstanceName=op_no_epoch, LocalOnly=False) self.assertIn(inst.path, (objpath, op_no_epoch)) - @base.mark_tedious - def test_enum_instance_names_safe(self): - """ - Tests EnumInstanceNames call on installed packages. - """ - inames = self.conn.EnumerateInstanceNames(ClassName=self.CLASS_NAME) - self.assertGreater(len(inames), 0) - for iname in inames: - self.assertIsInstance(iname, pywbem.CIMInstanceName) - self.assertEqual(iname.namespace, 'root/cimv2') - self.assertEqual(sorted(iname.keys()), sorted(self.KEYS)) - nevra_set = set(i["InstanceID"] for i in inames) - for pkg in self.safe_pkgs: - self.assertIn('LMI:LMI_SoftwareIdentity:'+pkg.get_nevra(with_epoch="ALWAYS"), - nevra_set) - -# @base.mark_tedious -# def test_enum_instances(self): -# """ -# Tests EnumInstances call on installed packages. -# """ -# insts = self.conn.EnumerateInstances(ClassName=self.CLASS_NAME) -# self.assertGreater(len(insts), 0) -# for inst in insts: -# self.assertIsInstance(inst, pywbem.CIMInstance) -# self.assertEqual(inst.namespace, 'root/cimv2') -# self.assertEqual(sorted(inst.keys()), sorted(self.KEYS)) -# self.assertEqual(inst["InstanceID"], inst.path["InstanceID"]) -# nevra_set = set() -# name_set = set() -# for inst in insts: -# nevra_set.add(inst["InstanceID"]) -# name_set.add(inst["Name"]) -# for pkg in self.safe_pkgs: -# self.assertIn("LMI:LMI_SoftwareIdentity:"+pkg.get_nevra(with_epoch="ALWAYS"), -# nevra_set) -# self.assertIn(pkg.name, name_set) - def suite(): """For unittest loaders.""" return unittest.TestLoader().loadTestsFromTestCase( -- cgit From f58b98ddbf805825b8701fdfbfa9d89ce504ed18 Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Mon, 29 Jul 2013 13:36:19 +0200 Subject: software fix test of Invoke() method Make sure, that tested package is installed and passes rpm verification test before its checked by our provider. --- src/software/test/test_software_identity_file_check.py | 6 +++++- src/software/test/util.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/software/test/test_software_identity_file_check.py b/src/software/test/test_software_identity_file_check.py index 49cd97d..3242113 100755 --- a/src/software/test/test_software_identity_file_check.py +++ b/src/software/test/test_software_identity_file_check.py @@ -31,6 +31,7 @@ import unittest import base import rpmcache +import util RE_CHECKSUM = re.compile(r'^([0-9a-fA-F]+)\s+.*') @@ -396,8 +397,11 @@ class TestSoftwareIdentityFileCheck( Tests Invoke method invocation. """ for pkg in self.dangerous_pkgs: + if ( rpmcache.is_pkg_installed(pkg.name) + and not util.verify_pkg(pkg.name)): + rpmcache.remove_pkg(pkg.name) if not rpmcache.is_pkg_installed(pkg.name): - rpmcache.install_pkg(pkg.name) + rpmcache.install_pkg(pkg) for filepath in self.pkgdb_files[pkg.name]: objpath = self.make_op(pkg, filepath) diff --git a/src/software/test/util.py b/src/software/test/util.py index e72add1..6de8169 100644 --- a/src/software/test/util.py +++ b/src/software/test/util.py @@ -24,7 +24,7 @@ Common test utilities. """ import re -from subprocess import check_output +from subprocess import call, check_output RE_NEVRA = re.compile( r'^(?P.+)-(?P(?P\d+):(?P[^-]+)' -- cgit