diff options
| author | Mike McCune <mmccune@gibson.pdx.redhat.com> | 2009-07-09 15:11:39 -0700 |
|---|---|---|
| committer | Mike McCune <mmccune@gibson.pdx.redhat.com> | 2009-07-09 15:12:40 -0700 |
| commit | cd305d823c9c45448b7b8e9b2ca5b515004ae217 (patch) | |
| tree | b3050c38a8e77866f666163bbb30a50089394480 /proxy/code/scripts | |
| parent | a402c6d2142dd7f7e3a7ef5210d32ecc3e4fb642 (diff) | |
| download | candlepin-cd305d823c9c45448b7b8e9b2ca5b515004ae217.tar.gz candlepin-cd305d823c9c45448b7b8e9b2ca5b515004ae217.tar.xz candlepin-cd305d823c9c45448b7b8e9b2ca5b515004ae217.zip | |
adding some basic API stuff for our model classes
Added a BaseApi class that allows some free basic code to other classes
that want to be able to be manipulated with REST.
Diffstat (limited to 'proxy/code/scripts')
| -rwxr-xr-x | proxy/code/scripts/test-connection.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/proxy/code/scripts/test-connection.py b/proxy/code/scripts/test-connection.py index 78d1798..4d38d1b 100755 --- a/proxy/code/scripts/test-connection.py +++ b/proxy/code/scripts/test-connection.py @@ -7,6 +7,8 @@ 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": "text/plain"} @@ -21,3 +23,20 @@ conn.close() response = urllib.urlopen('http://localhost:8080/candlepin/helloworld') rsp = response.read() 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) |
