summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-07-03 21:28:09 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-07-18 15:12:27 +0300
commit3b264a952d0ca07d449e8a0eeeb95f2c9be9d42a (patch)
tree8355566848dd67b9fc278028d292e0897012a2f0
parent62a994f0697f9cfa5a24567271bac9f7248fd033 (diff)
downloadobexd-3b264a952d0ca07d449e8a0eeeb95f2c9be9d42a.tar.gz
test: Update map-client to the changes in GetMessageListing
This makes map-client to print the object path and properties of each message found.
-rwxr-xr-xtest/map-client24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/map-client b/test/map-client
index da357a9..be3c307 100755
--- a/test/map-client
+++ b/test/map-client
@@ -6,6 +6,27 @@ import dbus
import dbus.mainloop.glib
from optparse import OptionParser
+from pprint import pformat
+
+def unwrap(x):
+ """Hack to unwrap D-Bus values, so that they're easier to read when
+ printed. Taken from d-feet """
+
+ if isinstance(x, list):
+ return map(unwrap, x)
+
+ if isinstance(x, tuple):
+ return tuple(map(unwrap, x))
+
+ if isinstance(x, dict):
+ return dict([(unwrap(k), unwrap(v)) for k, v in x.iteritems()])
+
+ for t in [unicode, str, long, int, float, bool]:
+ if isinstance(x, t):
+ return t(x)
+
+ return x
+
def parse_options():
parser.add_option("-d", "--device", dest="device",
help="Device to connect", metavar="DEVICE")
@@ -54,6 +75,7 @@ if __name__ == '__main__':
print "%s/" % (i["Name"])
if options.ls_msg is not None:
- print map.GetMessageListing(options.ls_msg, dict())
+ ret = map.GetMessageListing(options.ls_msg, dict())
+ print pformat(unwrap(ret))
mainloop.run()