summaryrefslogtreecommitdiffstats
path: root/test/test-call-forwarding
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-05-21 16:18:49 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-05-21 17:06:03 -0500
commit3016d0859dbf9b2340f488d4e3c61e7768fc7eed (patch)
tree58cbf7002413b020dc346666b00a1f1d6933097c /test/test-call-forwarding
parent6fb0d8dbfef6ff9e76d5dda990e52a2beb1fef0e (diff)
downloadofono-3016d0859dbf9b2340f488d4e3c61e7768fc7eed.tar.bz2
Adding basic Call Forwarding test scripts
Diffstat (limited to 'test/test-call-forwarding')
-rwxr-xr-xtest/test-call-forwarding122
1 files changed, 122 insertions, 0 deletions
diff --git a/test/test-call-forwarding b/test/test-call-forwarding
new file mode 100755
index 00000000..f4f30a28
--- /dev/null
+++ b/test/test-call-forwarding
@@ -0,0 +1,122 @@
+#!/usr/bin/python
+
+import gobject
+
+import dbus
+import dbus.mainloop.glib
+
+def property_changed(property, value):
+ print "CallForwarding property %s changed to %s" % (property, value)
+
+def print_properties(cf):
+ properties = cf.GetProperties()
+
+ for p in properties:
+ if len(properties[p].__str__()) > 0:
+ print "%s call forwarding rule is: %s" % (p, properties[p])
+ else:
+ print "%s call forwarding rule disabled" % (p)
+
+if __name__ == "__main__":
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+
+ try:
+ modems = manager.GetProperties()['Modems']
+ except dbus.DBusException, e:
+ print "Unable to get the modem list %s" % e
+
+ cf = dbus.Interface(bus.get_object('org.ofono', modems[0]),
+ 'org.ofono.CallForwarding')
+
+ cf.connect_to_signal("PropertyChanged", property_changed)
+
+ print_properties(cf)
+
+ try:
+ cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19))
+ except dbus.DBusException, e:
+ print "Unable to set timeout - Good"
+
+ try:
+ cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19))
+ except dbus.DBusException, e:
+ print "Unable to set timeout - Good"
+
+ try:
+ cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19))
+ except dbus.DBusException, e:
+ print "Unable to set timeout - Good"
+
+ try:
+ cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19))
+ except dbus.DBusException, e:
+ print "Unable to set timeout - Good"
+
+ try:
+ cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19))
+ except dbus.DBusException, e:
+ print "Unable to set timeout - Good"
+
+ try:
+ cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19))
+ except dbus.DBusException, e:
+ print "Unable to set timeout - Good"
+
+ try:
+ cf.SetProperty("VoiceNoReply", "")
+ except dbus.DBusException, e:
+ print "Unable to erase voice no reply rule - Bad"
+
+ try:
+ cf.SetProperty("VoiceNoReply", "+134444")
+ except dbus.DBusException, e:
+ print "Unable to register voice no reply rule - Bad"
+
+ try:
+ cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30))
+ except dbus.DBusException, e:
+ print "Unable to set voice no reply timeout - Bad"
+
+ properties = cf.GetProperties()
+
+ print properties["VoiceNoReply"]
+ print properties["VoiceNoReplyTimeout"]
+
+ try:
+ cf.SetProperty("VoiceUnconditional", "+155555")
+ except dbus.DBusException, e:
+ print "Unable to set Voice Unconditional - Bad"
+
+ properties = cf.GetProperties()
+
+ print properties["VoiceUnconditional"]
+
+ try:
+ cf.DisableAll("foobar")
+ except dbus.DBusException, e:
+ print "Unable to delete invalids - Good"
+
+ try:
+ cf.DisableAll("conditional")
+ except dbus.DBusException, e:
+ print "Unable to delete all conditional - Bad"
+
+ properties = cf.GetProperties()
+
+ print properties["VoiceNoReply"]
+ print properties["VoiceNoReplyTimeout"]
+
+ try:
+ cf.DisableAll("all")
+ except dbus.DBusException, e:
+ print "Unable to delete all conditional - Bad"
+
+ print properties["VoiceUnconditional"]
+
+ mainloop = gobject.MainLoop()
+ mainloop.run()