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 | |
| 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')
| -rwxr-xr-x | proxy/code/scripts/test-connection.py | 42 | ||||
| -rwxr-xr-x | proxy/code/scripts/test-userapi.py | 11 |
2 files changed, 8 insertions, 45 deletions
diff --git a/proxy/code/scripts/test-connection.py b/proxy/code/scripts/test-connection.py deleted file mode 100755 index 0aaca74..0000000 --- a/proxy/code/scripts/test-connection.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python - -import httplib, urllib -import sys - -if len(sys.argv) < 1: - print("please supply a message") - sys.exit(1) - -param = sys.argv[1] - -params = urllib.urlencode({'message':sys.argv[1]}) -headers = {"Content-type":"application/x-www-form-urlencoded", - "Accept": "application/json"} -conn = httplib.HTTPConnection("localhost", 8080) -conn.request("POST", '/candlepin/helloworld', params, headers) -#response = conn.getresponse() -#print response.status, response.reason -#rsp = response.read() -conn.close() -#print rsp - -# test creating org -params = urllib.urlencode({'name':'test-org-client-created-' + param}) -conn.request("POST", '/candlepin/org', params, headers) -response = conn.getresponse() -print response.status, response.reason -rsp = response.read() -print(rsp) - -# test creating consumer -params = urllib.urlencode({'name':'test-consumer-client-created-' + param}) -conn.request("POST", '/candlepin/consumer', params, headers) -response = conn.getresponse() -print response.status, response.reason -rsp = response.read() -print(rsp) - -response = urllib.urlopen('http://localhost:8080/candlepin/consumer/list') -rsp = response.read() -print(rsp) - 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) |
