summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-10-01 08:22:09 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-10-01 10:18:29 (GMT)
commit3e3ff223e68bbdaa12b237732230929b6887a305 (patch)
treeee11b76a83066cfef2b9e01b058c45b5c4c6c4fd /test
parentfa913d3900e820a5567d6044748d1e50d5c03bd0 (diff)
downloadconnman-3e3ff223e68bbdaa12b237732230929b6887a305.zip
connman-3e3ff223e68bbdaa12b237732230929b6887a305.tar.gz
connman-3e3ff223e68bbdaa12b237732230929b6887a305.tar.bz2
test: Check test-connman arguments
Check test-connman offlinemode arguments and the number of arguments in general. Fixes BMC#25723
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-connman27
1 files changed, 19 insertions, 8 deletions
diff --git a/test/test-connman b/test/test-connman
index 67b0c85..d047c86 100755
--- a/test/test-connman
+++ b/test/test-connman
@@ -145,38 +145,49 @@ elif sys.argv[1] in ["remove"]:
print "%s: %s" % (error._dbus_error_name, error.message)
elif sys.argv[1] == "scan":
- if len(sys.argv) > 2:
+ if len(sys.argv) == 3:
path = "/net/connman/technology/" + sys.argv[2]
technology = dbus.Interface(bus.get_object("net.connman", path),
"net.connman.Technology")
technology.Scan()
+ else:
+ print "'%s' takes two arguments" % sys.argv[1]
elif sys.argv[1] == "enable":
- if len(sys.argv) > 2:
+ if len(sys.argv) == 3:
path = "/net/connman/technology/" + sys.argv[2]
technology = dbus.Interface(bus.get_object("net.connman", path),
"net.connman.Technology")
technology.SetProperty("Powered", True)
+ else:
+ print "'%s' takes two arguments" % sys.argv[1]
elif sys.argv[1] == "disable":
- if len(sys.argv) > 2:
+ if len(sys.argv) == 3:
path = "/net/connman/technology/" + sys.argv[2]
technology = dbus.Interface(bus.get_object("net.connman", path),
"net.connman.Technology")
technology.SetProperty("Powered", False)
+ else:
+ print "'%s' takes two arguments" % sys.argv[1]
+
elif sys.argv[1] in ["offlinemode", "flightmode"]:
- if len(sys.argv) > 2:
- if sys.argv[2] == "on":
+ if len(sys.argv) == 3:
+ if sys.argv[2] == "on" or sys.argv[2] == "1" or sys.argv[2] == "yes":
active = dbus.Boolean(1)
- elif sys.argv[2] == "off":
+ elif sys.argv[2] == "off" or sys.argv[2] == "0" or sys.argv[2] == "no":
active = dbus.Boolean(0)
else:
- active = dbus.Boolean(sys.argv[2])
+ print "Use either 'on', '1', 'yes', 'off', '0' or 'no'"
+ exit()
+
manager.SetProperty("OfflineMode", active)
- else:
+ elif len(sys.argv) == 2:
properties = manager.GetProperties()
print "Offline mode is %s" % (properties["OfflineMode"])
+ else:
+ print "'%s' takes max. two arguments" % sys.argv[1]
else:
print "Unknown command"