summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHenri Bragge <henri.bragge@ixonos.com>2011-03-31 15:49:33 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-04-01 18:26:48 +0200
commit672d56435e6d28acd769d0220e6e49df6b90005f (patch)
tree04b0c8d3b1a51adcfa7415c9ac4b8d1de492d42b /test
parentba8f0c64622661f6055b9a78141d0acc8d35e657 (diff)
downloadconnman-672d56435e6d28acd769d0220e6e49df6b90005f.tar.gz
connman-672d56435e6d28acd769d0220e6e49df6b90005f.tar.bz2
connman-672d56435e6d28acd769d0220e6e49df6b90005f.zip
test: Add identity response support to simple-agent
Support also responding with arbitrary combination of parameters, instead of only one property at a time.
Diffstat (limited to 'test')
-rwxr-xr-xtest/simple-agent21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/simple-agent b/test/simple-agent
index 5c735995..b0990de6 100755
--- a/test/simple-agent
+++ b/test/simple-agent
@@ -11,6 +11,7 @@ class Canceled(dbus.DBusException):
_dbus_error_name = "net.connman.Error.Canceled"
class Agent(dbus.service.Object):
+ identity = None
passphrase = None
wpspin = None
@@ -26,12 +27,16 @@ class Agent(dbus.service.Object):
def RequestInput(self, path, fields):
print "RequestInput (%s,%s)" % (path, fields)
- if not self.passphrase and not self.wpspin:
- args = raw_input('Answer: ')
+ response = {}
- response = {}
+ if not self.identity and not self.passphrase and not self.wpspin:
+ args = raw_input('Answer: ')
for arg in args.split():
+ if arg.startswith("Identity="):
+ identity = arg.replace("Identity=", "", 1)
+ response["Identity"] = identity
+ break
if arg.startswith("Passphrase="):
passphrase = arg.replace("Passphrase=", "", 1)
response["Passphrase"] = passphrase
@@ -41,9 +46,11 @@ class Agent(dbus.service.Object):
response["WPS"] = wpspin
break
else:
+ if self.identity:
+ response["Identity"] = self.identity
if self.passphrase:
response["Passphrase"] = self.passphrase
- else:
+ if self.wpspin:
response["WPS"] = self.wpspin
print "returning (%s)" % (response)
@@ -71,7 +78,7 @@ class Agent(dbus.service.Object):
print "Cancel"
def print_usage():
- print "Usage: %s Passphrase=<passphrase> WPS=<wpspin>" % (sys.argv[0])
+ print "Usage: %s Identity=<identity> Passphrase=<passphrase> WPS=<wpspin>" % (sys.argv[0])
print "Help: %s help" % (sys.ar[0])
sys.exit(1)
@@ -90,7 +97,9 @@ if __name__ == '__main__':
if len(sys.argv) >= 2:
for arg in sys.argv[1:]:
- if arg.startswith("Passphrase="):
+ if arg.startswith("Identity="):
+ object.identity = arg.replace("Identity=", "", 1)
+ elif arg.startswith("Passphrase="):
object.passphrase = arg.replace("Passphrase=", "", 1)
elif arg.startswith("WPS="):
object.wpspin = arg.replace("WPS=", "", 1)