summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-05-12 20:51:07 -0300
committerVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-05-13 10:08:14 -0300
commit7d98f73f449a5eb2a7244f6e4836f92a94dbcbdf (patch)
treea27623cd4f3bf37f3801390a48e60e28fd0f8813 /test
parent4e7424023040eef4e021e7e0f0308c3709ecd718 (diff)
downloadobexd-7d98f73f449a5eb2a7244f6e4836f92a94dbcbdf.tar.gz
Fix pull-business-card test script
As the PullBusinessCard method is asynchronous we have to wait until we get some reply.
Diffstat (limited to 'test')
-rwxr-xr-xtest/pull-business-card32
1 files changed, 26 insertions, 6 deletions
diff --git a/test/pull-business-card b/test/pull-business-card
index 253476d..b13968d 100755
--- a/test/pull-business-card
+++ b/test/pull-business-card
@@ -2,13 +2,33 @@
import sys
import dbus
+import gobject
+import dbus.mainloop.glib
-bus = dbus.SessionBus()
-client = dbus.Interface(bus.get_object("org.openobex.client", "/"),
+def success():
+ mainloop.quit()
+ return
+
+def failure(error):
+ print error
+ mainloop.quit()
+ return
+
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ mainloop = gobject.MainLoop()
+
+ bus = dbus.SessionBus()
+ client = dbus.Interface(bus.get_object("org.openobex.client", "/"),
"org.openobex.Client")
-if (len(sys.argv) < 3):
- print "Usage: %s <device> <file>" % (sys.argv[0])
- sys.exit(1)
+ if (len(sys.argv) < 3):
+ print "Usage: %s <device> <file>" % (sys.argv[0])
+ sys.exit(1)
+
+ client.PullBusinessCard({ "Destination": sys.argv[1] }, sys.argv[2],
+ reply_handler=success, error_handler=failure)
-client.PullBusinessCard({ "Destination": sys.argv[1] }, sys.argv[2])
+ mainloop.run()