
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1215806699 25200 # Node ID ee18f55760d08d21cd8f9809293d972b4a0b4549 # Parent 6fe68391f0c820e815251022bfe8469a0a93115b [TEST] Add compare_all_prop(). This function takes an instance from the list returned bu the Associators() call and an instance from a getInstance() / enumerate_instances() call. It compares all of the property values to ensure the instances are identical. This function could probably be added to a fair number of tests as an additional verification check. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 6fe68391f0c8 -r ee18f55760d0 suites/libvirt-cim/lib/XenKvmLib/assoc.py --- a/suites/libvirt-cim/lib/XenKvmLib/assoc.py Thu Jun 05 19:28:30 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/assoc.py Fri Jul 11 13:04:59 2008 -0700 @@ -27,6 +27,7 @@ import pywbem from pywbem.cim_obj import CIMInstanceName from XenKvmLib.classes import get_typed_class +from CimTest.ReturnCodes import PASS def AssociatorNames(host, basetype, baseobj, virt="Xen", **keys): '''Resolve the association specified by @type, given the @@ -139,3 +140,17 @@ return new_list +def compare_all_prop(inst, exp_inst): + prop_vals = inst.items() + + for i in range(0, len(prop_vals)): + key = prop_vals[i][0] + val = eval('exp_inst.' + key) + + if prop_vals[i][1] != val: + logger.error("%s val mismatch: got %s, expected %s" % (key, + prop_vals[i][1], val)) + return FAIL + + return PASS +