diff options
author | Andrew Zaborowski <andrew.zaborowski@intel.com> | 2020-02-15 01:17:48 +0100 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2020-02-17 12:28:21 -0600 |
commit | 58737e02d5886a18d36d0d4f3eddcd648b561ed9 (patch) | |
tree | 7019d0d7ff60a22a6744112da980511aaaeb0fcd | |
parent | 0b34371253767db7db314b57aa42bc1a0c4a1ce0 (diff) | |
download | iwd-58737e02d5886a18d36d0d4f3eddcd648b561ed9.tar.gz |
test: Handle missing agent calls in simple-agent
Handle RequestPrivateKeyPassphrase and RequestUserNameAndPassword
-rwxr-xr-x | test/simple-agent | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/simple-agent b/test/simple-agent index 79cee0212..cdfc20761 100755 --- a/test/simple-agent +++ b/test/simple-agent @@ -36,6 +36,41 @@ class Agent(dbus.service.Object): return passphrase @dbus.service.method("net.connman.iwd.Agent", + in_signature='o', + out_signature='s') + def RequestPrivateKeyPassphrase(self, path): + print("RequestPrivateKeyPassphrase (%s)" % (path)) + + print("Service credentials requested, type cancel to cancel") + passphrase = input('Answer: ') + + if not passphrase or passphrase == 'cancel': + raise Canceled("canceled") + + print("returning (%s)" % (passphrase)) + return passphrase + + @dbus.service.method("net.connman.iwd.Agent", + in_signature='o', + out_signature='ss') + def RequestUserNameAndPassword(self, path): + print("RequestPrivateKeyPassphrase (%s)" % (path)) + + print("Service credentials requested, type cancel to cancel") + user = input('User name: ') + + if not user or user == 'cancel': + raise Canceled("canceled") + + passwd = input('User password: ') + + if not passwd or passwd == 'cancel': + raise Canceled("canceled") + + print("returning (%s, %s)" % (user, passwd)) + return (user, passwd) + + @dbus.service.method("net.connman.iwd.Agent", in_signature='s', out_signature='') def Cancel(self, reason): print("Cancel: " + reason) |