summaryrefslogtreecommitdiffstats
path: root/src/python
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2014-01-23 15:04:07 +0100
committerMichal Minar <miminar@redhat.com>2014-01-24 10:14:33 +0100
commitb95b572144f54e51df9f5322ee9e3101b73a2e1e (patch)
tree86c4d50e2328054b9e457c8d1d7f2e0b351e1d76 /src/python
parent691b44e7cba10446b7f8dc3df83e312ab63f97d9 (diff)
downloadopenlmi-providers-b95b572144f54e51df9f5322ee9e3101b73a2e1e.tar.gz
openlmi-providers-b95b572144f54e51df9f5322ee9e3101b73a2e1e.tar.xz
openlmi-providers-b95b572144f54e51df9f5322ee9e3101b73a2e1e.zip
tests: compare encoded values of keys
When comparing instance names, treat unicode and str objects the same. Byte strings are supposed to use utf-8 encoding. Therefor unicode strings need to be encoded before comparison.
Diffstat (limited to 'src/python')
-rw-r--r--src/python/lmi/test/util.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/python/lmi/test/util.py b/src/python/lmi/test/util.py
index 602c903..615a81e 100644
--- a/src/python/lmi/test/util.py
+++ b/src/python/lmi/test/util.py
@@ -121,6 +121,14 @@ def check_inames_equal(fst, snd):
p['CreationClassName'] for p in (fst, snd)]):
return False
+ elif isinstance(value, basestring) \
+ and isinstance(snd_value, basestring):
+ value = value.decode('utf-8') if isinstance(value, str) else value
+ snd_value = ( snd_value.decode('utf-8')
+ if isinstance(snd_value, str) else snd_value)
+ if value != snd_value:
+ return False
+
elif value != snd_value:
return False