summaryrefslogtreecommitdiffstats
path: root/src/software/test/test_software_package.py
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2012-12-12 10:51:40 +0100
committerMichal Minar <miminar@redhat.com>2012-12-13 13:27:31 +0100
commit54e501a7225d30695bdcc2edb3b406986290e6e6 (patch)
tree905c4c0ac5a4c746e75c9006ca63013cd53c6864 /src/software/test/test_software_package.py
parent51d608eb5db9d977750709fb9ad4a0fad2be6c02 (diff)
downloadopenlmi-providers-54e501a7225d30695bdcc2edb3b406986290e6e6.tar.gz
openlmi-providers-54e501a7225d30695bdcc2edb3b406986290e6e6.tar.xz
openlmi-providers-54e501a7225d30695bdcc2edb3b406986290e6e6.zip
fixed test selection, when launching tests with run
particular tests can be selected like this: * # runs all tests defined by this test case ./run.py -- TestSoftwarePackage * # runs single test defined by TestSoftwarePackage TestCase ./run.py -- TestSoftwarePackage.test_get_instance added comments for each assert made results of tests a lot more readable different file mode for symlinks passes like in rpm -V increased number of packages for testing to 5
Diffstat (limited to 'src/software/test/test_software_package.py')
-rwxr-xr-xsrc/software/test/test_software_package.py43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/software/test/test_software_package.py b/src/software/test/test_software_package.py
index d0144ca..3411678 100755
--- a/src/software/test/test_software_package.py
+++ b/src/software/test/test_software_package.py
@@ -61,15 +61,20 @@ class TestSoftwarePackage(common.SoftwareBaseTestCase): #pylint: disable=R0904
common.remove_pkg(pkg.name)
objpath = self.make_op(pkg, ses=1)
inst = self.conn.GetInstance(InstanceName=objpath, LocalOnly=False)
- self.assertEqual(inst.path, objpath)
+ self.assertEqual(inst.path, objpath,
+ "Object paths should match for %s"%pkg)
for key in self.KEYS:
- self.assertTrue(inst.properties.has_key(key))
- self.assertEqual(inst.path[key], inst[key])
- self.assertEqual(inst['Release'], pkg.up_rel)
+ self.assertTrue(inst.properties.has_key(key),
+ "OP is missing \"%s\" key for package %s"%(key, pkg))
+ self.assertEqual(inst.path[key], inst[key],
+ "Object paths of instance should match for %s"%pkg)
+ self.assertEqual(pkg.up_rel, inst['Release'],
+ "Release property should match for %s"%pkg)
common.install_pkg(pkg)
objpath['SoftwareElementState'] = pywbem.Uint16(2)
inst = self.conn.GetInstance(InstanceName=objpath, LocalOnly=False)
- self.assertEqual(inst.path, objpath)
+ self.assertEqual(inst.path, objpath,
+ "Object paths should match for %s"%pkg)
# try to leave out epoch part
if pkg.epoch == "0":
@@ -93,18 +98,23 @@ class TestSoftwarePackage(common.SoftwareBaseTestCase): #pylint: disable=R0904
(rval, oparms) = self.conn.InvokeMethod(
MethodName="Install",
ObjectName=objpath)
- self.assertEqual(rval, pywbem.Uint32(1))
- self.assertEqual(len(oparms), 1)
+ self.assertEqual(pywbem.Uint32(1), rval,
+ "Installation of %s should be successful"%pkg)
+ self.assertEqual(1, len(oparms))
self.assertTrue(oparms.has_key('Installed'))
objpath['SoftwareElementState'] = pywbem.Uint16(2)
- self.assertEqual(oparms['Installed'], objpath)
- self.assertTrue(common.is_installed(pkg.name))
+ self.assertEqual(oparms['Installed'], objpath,
+ "Object paths should match for %s"%pkg)
+ self.assertTrue(common.is_installed(pkg.name),
+ "Package %s must be installed"%pkg)
(rval, oparms) = self.conn.InvokeMethod(
MethodName="Install",
ObjectName=objpath)
- self.assertEqual(rval, pywbem.Uint32(0))
+ self.assertEqual(pywbem.Uint32(0), rval,
+ "Installation of %s should fail"%pkg)
self.assertEqual(len(oparms), 1)
- self.assertEqual(oparms['Installed'], objpath)
+ self.assertEqual(oparms['Installed'], objpath,
+ "Object paths should match for %s"%pkg)
@common.mark_dangerous
def test_method_remove(self):
@@ -118,14 +128,17 @@ class TestSoftwarePackage(common.SoftwareBaseTestCase): #pylint: disable=R0904
(rval, oparms) = self.conn.InvokeMethod(
MethodName="Remove",
ObjectName=objpath)
- self.assertEqual(rval, pywbem.Uint16(1))
- self.assertEqual(len(oparms), 0)
- self.assertFalse(common.is_installed(pkg.name))
+ self.assertEqual(pywbem.Uint16(1), rval,
+ "Removal of package should succeed"%pkg)
+ self.assertEqual(0, len(oparms))
+ self.assertFalse(common.is_installed(pkg.name),
+ "Package %s should not be installed"%pkg)
objpath["SoftwareElementState"] = pywbem.Uint16(1)
(rval, oparms) = self.conn.InvokeMethod(
MethodName="Remove",
ObjectName=objpath)
- self.assertEqual(rval, pywbem.Uint32(0))
+ self.assertEqual(pywbem.Uint32(0), rval,
+ "Removal of %s should fail"%pkg)
self.assertEqual(len(oparms), 0)
def suite():