summaryrefslogtreecommitdiffstats
path: root/proxy/code/scripts/test-testapi.py
diff options
context:
space:
mode:
authorjesus m. rodriguez <jesusr@redhat.com>2009-07-30 14:54:43 -0400
committerjesus m. rodriguez <jesusr@redhat.com>2009-07-30 14:54:43 -0400
commit5da18950ed4186cf410dde4ab307754d450112f9 (patch)
tree10f8b31dab28c3c8b63b8d4743594d54d795fc36 /proxy/code/scripts/test-testapi.py
parenta88dbeab8f95777bc7e34ace9591867fcbd9647e (diff)
downloadcandlepin-5da18950ed4186cf410dde4ab307754d450112f9.tar.gz
candlepin-5da18950ed4186cf410dde4ab307754d450112f9.tar.xz
candlepin-5da18950ed4186cf410dde4ab307754d450112f9.zip
adding a test api to cleanup userapi
Diffstat (limited to 'proxy/code/scripts/test-testapi.py')
-rwxr-xr-xproxy/code/scripts/test-testapi.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/proxy/code/scripts/test-testapi.py b/proxy/code/scripts/test-testapi.py
new file mode 100755
index 0000000..e60bd27
--- /dev/null
+++ b/proxy/code/scripts/test-testapi.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import httplib, urllib
+import sys
+
+if len(sys.argv) < 1:
+ print("please supply a message")
+ sys.exit(1)
+
+print("------------ TESTING json create")
+params = '{"name":"now","uuid":"thiswork"}'
+headers = {"Content-type":"application/json",
+ "Accept": "application/json"}
+conn = httplib.HTTPConnection("localhost", 8080)
+print("creating object with %s" % params)
+conn.request("POST", '/candlepin/test/', params, headers)
+response = conn.getresponse()
+print("Status: %d Response: %s" % (response.status, response.reason))
+rsp = response.read()
+conn.close()
+print("------------ TESTING json get")
+response = urllib.urlopen("http://localhost:8080/candlepin/test/")
+rsp = response.read()
+print("testjsonobject get: %s" % rsp)