diff options
author | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-30 19:53:34 -0400 |
---|---|---|
committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-30 19:53:34 -0400 |
commit | 7e49a1ff602e26b015a0a18ee824411e0061ff6d (patch) | |
tree | fbe2a83a0ac8cdb032cd59a8d403334357b4cb42 /proxy/code/scripts/test-userapi.py | |
parent | 5da18950ed4186cf410dde4ab307754d450112f9 (diff) | |
download | candlepin-7e49a1ff602e26b015a0a18ee824411e0061ff6d.tar.gz candlepin-7e49a1ff602e26b015a0a18ee824411e0061ff6d.tar.xz candlepin-7e49a1ff602e26b015a0a18ee824411e0061ff6d.zip |
fix user api tests
Diffstat (limited to 'proxy/code/scripts/test-userapi.py')
-rwxr-xr-x | proxy/code/scripts/test-userapi.py | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/proxy/code/scripts/test-userapi.py b/proxy/code/scripts/test-userapi.py index 317c970..0851a6e 100755 --- a/proxy/code/scripts/test-userapi.py +++ b/proxy/code/scripts/test-userapi.py @@ -3,58 +3,12 @@ import httplib, urllib import sys -if len(sys.argv) < 1: - print("please supply a message") - sys.exit(1) - -params = urllib.urlencode({'login':'candlepin', 'password':'cp_p@s$w0rd'}) -headers = {"Content-type":"application/json", - "Accept": "application/json"} -conn = httplib.HTTPConnection("localhost", 8080) -conn.request("POST", '/candlepin/user', params, headers) -response = conn.getresponse() -print("Status: %d Response: %s" % (response.status, response.reason)) -rsp = response.read() -conn.close() -print("create: %s" % rsp) -""" +# GET candlepin user response = urllib.urlopen('http://localhost:8080/candlepin/user/candlepin') rsp = response.read() print("get: %s" % rsp) -response = urllib.urlopen('http://localhost:8080/candlepin/user/list') -rsp = response.read() -print("list: %s" % rsp) - -response = urllib.urlopen('http://localhost:8080/candlepin/user/listusers') -rsp = response.read() -print("listusers: %s" % rsp) - -response = urllib.urlopen('http://localhost:8080/candlepin/user/uselist') -rsp = response.read() -print("uselist: %s" % rsp) - -response = urllib.urlopen('http://localhost:8080/candlepin/user/listobjects') -rsp = response.read() -print("listobjects: %s" % rsp) - -response = urllib.urlopen('http://localhost:8080/candlepin/user/listbasemodel') -rsp = response.read() -print("listbasemodel: %s" % rsp) - -""" -print("------------ TESTING json create") -#params = urllib.urlencode({"name":"rhim","uuid":"joprsucks"}) -params = '{"name":"now","uuid":"thiswork"}' -headers = {"Content-type":"application/json", - "Accept": "application/json"} -conn = httplib.HTTPConnection("localhost", 8080) -conn.request("POST", '/candlepin/user/createtestobject', 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/user/testobject") +# GET list of users +response = urllib.urlopen('http://localhost:8080/candlepin/user/') rsp = response.read() -print("testjsonobject get: %s" % rsp) +print("list of users: %s" % rsp) |