Adding some hand tests
authorEd Page <eopage@byu.net>
Thu, 21 Jan 2010 04:31:38 +0000 (22:31 -0600)
committerEd Page <eopage@byu.net>
Thu, 21 Jan 2010 04:31:38 +0000 (22:31 -0600)
hand_tests/abook.py [new file with mode: 0755]
hand_tests/hand_conic.py [new file with mode: 0755]

diff --git a/hand_tests/abook.py b/hand_tests/abook.py
new file mode 100755 (executable)
index 0000000..8063b72
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import sys
+sys.path.insert(0,"../src")
+import logging
+
+import gvoice.backend as backend
+import gvoice.addressbook as abook
+
+
+def main():
+       logging.basicConfig(level=logging.DEBUG)
+
+       args = sys.argv
+       username = args[1]
+       password = args[2]
+
+       b = backend.GVoiceBackend()
+       b.login(username, password)
+       assert b.is_authed()
+
+       book = abook.Addressbook(b)
+       book.update()
+       for number in book.get_numbers():
+               print number, book.get_contact_name(number), book.get_phone_type(number)
+
+
+if __name__ == "__main__":
+       main()
+
diff --git a/hand_tests/hand_conic.py b/hand_tests/hand_conic.py
new file mode 100755 (executable)
index 0000000..b51981e
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+import gtk
+import conic
+
+
+def on_connection_change(connection, event):
+       status = event.get_status()
+       error = event.get_error()
+       iap_id = event.get_iap_id()
+       bearer = event.get_bearer_type()
+       if status == conic.STATUS_DISCONNECTED:
+               print "Disconnected"
+       elif status == conic.STATUS_DISCONNECTING:
+               print "Disconnecting"
+       elif status == conic.STATUS_CONNECTED:
+               print "Connected"
+       elif status == conic.STATUS_NETWORK_UP:
+               print "Network Up"
+
+
+if __name__ == "__main__":
+       connection = conic.Connection()
+       connectionEventId = connection.connect("connection-event", on_connection_change)
+       print connectionEventId
+       try:
+               gtk.main()
+       except:
+               connection.disconnect()
+               raise