diff options
author | root <root@ziggy.robocracy.org> | 2012-07-12 15:47:36 -0400 |
---|---|---|
committer | root <root@ziggy.robocracy.org> | 2012-07-12 15:47:36 -0400 |
commit | 420106d5a9823b81fe686789831dd2354bfaa678 (patch) | |
tree | 6f88594ea1e2e42269bd02571c2b84e374e31836 /test.py | |
parent | abaec3f515523310a8b743f13d60b905885a9f13 (diff) | |
download | exmachina-420106d5a9823b81fe686789831dd2354bfaa678.tar.gz exmachina-420106d5a9823b81fe686789831dd2354bfaa678.zip |
progress
Diffstat (limited to 'test.py')
-rwxr-xr-x | test.py | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1,5 +1,12 @@ #!/usr/bin/env python +""" +To use with secret keys, do: + + $ echo "<key>" | ./test.py -k + +""" + import sys import optparse import logging @@ -19,8 +26,16 @@ def main(): sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(socket_path) + secret_key = None + if sys.argv[-1] == "-k": + print "waiting for key on stdin..." + secret_key = sys.stdin.readline() + print "sent!" + print "========= Testing low level connection" c = bjsonrpc.connection.Connection(sock) + if secret_key: + c.call.authenticate(secret_key) print "time: %s" % c.call.test_whattime() print "/*: %s" % c.call.augeas_match("/*") print "/augeas/*: %s" % c.call.augeas_match("/augeas/*") @@ -33,11 +48,12 @@ def main(): sock.close() print "========= Testing user client library" - client = ExMachinaClient() + client = ExMachinaClient(secret_key=secret_key) print client.augeas.match("/files/etc/*") print client.initd.restart("bluetooth") - print client.initd.status("bluetooth") print client.initd.status("greentooth") + print "(expect Error on the above line)" + print client.initd.status("bluetooth") client.close() if __name__ == '__main__': |