[open-ils-commits] r8365 -
branches/acq-experiment/Open-ILS/src/support-scripts/test-scripts
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 9 11:10:07 EST 2008
Author: erickson
Date: 2008-01-09 10:45:28 -0500 (Wed, 09 Jan 2008)
New Revision: 8365
Added:
branches/acq-experiment/Open-ILS/src/support-scripts/test-scripts/acq_fund.py
Log:
committing some rough example python code for access the ACQ ml methods
Added: branches/acq-experiment/Open-ILS/src/support-scripts/test-scripts/acq_fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/src/support-scripts/test-scripts/acq_fund.py (rev 0)
+++ branches/acq-experiment/Open-ILS/src/support-scripts/test-scripts/acq_fund.py 2008-01-09 15:45:28 UTC (rev 8365)
@@ -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()
+
+
More information about the open-ils-commits
mailing list