test: Add test for listing messages
authorDenis Kenzior <denkenz@gmail.com>
Sat, 29 Jan 2011 02:29:15 +0000 (20:29 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Sat, 29 Jan 2011 02:29:15 +0000 (20:29 -0600)
Makefile.am
test/list-messages [new file with mode: 0755]

index 9b77e63..e6b308b 100644 (file)
@@ -474,7 +474,8 @@ test_scripts = test/backtrace \
                test/cdma-list-call \
                test/cdma-dial-number \
                test/cdma-hangup \
-               test/disable-call-forwarding
+               test/disable-call-forwarding \
+               test/list-messages
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/list-messages b/test/list-messages
new file mode 100755 (executable)
index 0000000..d3e95e6
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                               'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+       print "[ %s ]" % (path)
+
+       if "org.ofono.MessageManager" not in properties["Interfaces"]:
+               continue
+
+       connman = dbus.Interface(bus.get_object('org.ofono', path),
+                                       'org.ofono.MessageManager')
+
+       contexts = connman.GetMessages()
+
+       for path, properties in contexts:
+               print "    [ %s ]" % (path)
+
+               for key in properties.keys():
+                       val = str(properties[key])
+                       print "        %s = %s" % (key, val)
+
+               print