From b78b3ce2451ca6d12ed65677ea63e7ee5e60041a Mon Sep 17 00:00:00 2001 From: "jesus m. rodriguez" Date: Wed, 18 Nov 2009 21:58:14 -0500 Subject: remove unused test-connection, fix userapi --- proxy/code/scripts/test-userapi.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'proxy/code/scripts/test-userapi.py') diff --git a/proxy/code/scripts/test-userapi.py b/proxy/code/scripts/test-userapi.py index 89c1a1f..fc4c8f7 100755 --- a/proxy/code/scripts/test-userapi.py +++ b/proxy/code/scripts/test-userapi.py @@ -5,16 +5,18 @@ import sys import simplejson as json # POST new user -params = {"login":"testapi","password":"sw3etnothings"} +params = urllib.urlencode({"login":"testapi","password":"sw3etnothings"}) headers = {"Content-type":"application/json", "Accept": "application/json"} conn = httplib.HTTPConnection("localhost", 8080) -conn.request("POST", '/candlepin/user/', json.dumps(params), headers) +print("params: %s" % json.dumps(params)) +conn.request("POST", '/candlepin/user/', params, headers) response = conn.getresponse() print("Status: %d Response: %s" % (response.status, response.reason)) rsp = response.read() conn.close() + # GET testapi user response = urllib.urlopen('http://localhost:8080/candlepin/user/testapi') rsp = response.read() @@ -23,4 +25,7 @@ print("get: %s" % rsp) # GET list of users response = urllib.urlopen('http://localhost:8080/candlepin/user/') rsp = response.read() -print("list of users: %s" % rsp) +users = json.loads(rsp) +print("list of users ----------------") +for user in users['user']: + print(user) -- cgit