From 73953214feaa9bff5d70307304cef8c9de442ae9 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 9 Jan 2008 15:45:28 +0000 Subject: [PATCH] committing some rough example python code for access the ACQ ml methods git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8365 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/support-scripts/test-scripts/acq_fund.py | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Open-ILS/src/support-scripts/test-scripts/acq_fund.py diff --git a/Open-ILS/src/support-scripts/test-scripts/acq_fund.py b/Open-ILS/src/support-scripts/test-scripts/acq_fund.py new file mode 100644 index 0000000000..7a8c35f9d1 --- /dev/null +++ b/Open-ILS/src/support-scripts/test-scripts/acq_fund.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +import sys +import oils.system, oils.utils.utils +import osrf.net_obj, osrf.ses + +oils.system.oilsConnect('/openils/conf/opensrf_core.xml', 'config.opensrf') +auth_info = oils.utils.utils.login(sys.argv[1], sys.argv[2], 'staff', sys.argv[3]) +authtoken = auth_info['payload']['authtoken'] + +ses = osrf.ses.ClientSession('open-ils.acq') +ses.connect() + +# XXX This loop assumes the existence of orgs with IDs 1-6 +ids = [] +for i in range(0,5): + fund = osrf.net_obj.NetworkObject.acqfund() + fund.name("test-fund-%d" % i) + fund.owner(i+1) + fund.currency_type('USD') + req = ses.request('open-ils.acq.fund.create', authtoken, fund) + id = req.recv().content() + print 'created fund ' + str(id) + ids.append(id) + +req = ses.request('open-ils.acq.fund.org.retrieve', authtoken, 1, {"children":1}) +resp = req.recv().content() +for fund in resp: + print 'fetched fund ' + str(fund.name()) + +for i in ids: + req = ses.request('open-ils.acq.fund.delete', authtoken, i) + print 'delete returned ' + str(req.recv().content()) + + +ses.disconnect() + + -- 2.11.0