From 53339ea82c5b48331d2132410f1efccb15849e9f Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Mon, 3 Dec 2001 23:00:27 +0000 Subject: [PATCH] Add python test - still need to see how we can do Authorization header --- phpgwapi/doc/xmlrpc/test.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 phpgwapi/doc/xmlrpc/test.py diff --git a/phpgwapi/doc/xmlrpc/test.py b/phpgwapi/doc/xmlrpc/test.py new file mode 100755 index 0000000000..ba05112cb0 --- /dev/null +++ b/phpgwapi/doc/xmlrpc/test.py @@ -0,0 +1,38 @@ +#!/usr/bin/python + +# $Id$ + +from xmlrpclib import * +import sys + +server = Server("http://www.phpgroupware.org/cvsdemo/xmlrpc.php"); + +try: + print "Listing methods:" + r = server.system.listMethods(); + print r + + print "Trying to login:" + up = {'domain': 'default', 'username': 'demo', 'password': 'guest'} + l = server.system.login(up); + print l + + # name/age example. this exercises structs and arrays + a = [ {'name': 'Dave', 'age': 35}, {'name': 'Edd', 'age': 45 }, + {'name': 'Fred', 'age': 23}, {'name': 'Barney', 'age': 36 }] + r = server.examples.sortByAge(a) + print r + + # test base 64 + b = Binary("Mary had a little lamb She tied it to a pylon") + b.encode(sys.stdout) + r = server.examples.decode64(b) + print r + + print "Trying to logout:" + sk = {'sessionid': l['sessionid'], 'kp3': l['kp3']} + r = server.system.logout(sk); + print r + +except Error, v: + print "XML-RPC Error:",v