diff options
author | jesus m. rodriguez <jesusr@redhat.com> | 2009-11-18 21:58:14 -0500 |
---|---|---|
committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-11-18 21:58:14 -0500 |
commit | b78b3ce2451ca6d12ed65677ea63e7ee5e60041a (patch) | |
tree | 50d8f3d6b70a043a60d44a0773c41a457b89ff55 /proxy/code/scripts/test-userapi.py | |
parent | 0b6e5469af00e30a11370d6a9402d59d9e74c2df (diff) | |
download | candlepin-b78b3ce2451ca6d12ed65677ea63e7ee5e60041a.tar.gz candlepin-b78b3ce2451ca6d12ed65677ea63e7ee5e60041a.tar.xz candlepin-b78b3ce2451ca6d12ed65677ea63e7ee5e60041a.zip |
remove unused test-connection, fix userapi
Diffstat (limited to 'proxy/code/scripts/test-userapi.py')
-rwxr-xr-x | proxy/code/scripts/test-userapi.py | 11 |
1 files changed, 8 insertions, 3 deletions
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) |