committing some rough example python code for access the ACQ ml methods
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 9 Jan 2008 15:45:28 +0000 (15:45 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 9 Jan 2008 15:45:28 +0000 (15:45 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8365 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/test-scripts/acq_fund.py [new file with mode: 0644]

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 (file)
index 0000000..7a8c35f
--- /dev/null
@@ -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()
+
+