summaryrefslogtreecommitdiffstats
path: root/proxy/code/scripts/test-entitlementapi.py
blob: 06d81140b95197b3f011927c9fcf06a20e13c296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python

import httplib, urllib
import sys
import simplejson

params = urllib.urlencode({'name':'entitlement'})
headers = {"Content-type":"application/json",
           "Accept": "application/json"}
conn = httplib.HTTPConnection("localhost", 8080)
conn.request("POST", '/candlepin/entitlement', params, headers)
response = conn.getresponse()
print("Status: %d Response: %s" % (response.status, response.reason))
rsp = response.read()
conn.close()
print("create: %s" % rsp)

response = urllib.urlopen('http://localhost:8080/candlepin/entitlement/candlepin')
rsp = response.read()
print("get: %s" % rsp)

response = urllib.urlopen('http://localhost:8080/candlepin/entitlement/list')
rsp = response.read()
print("list: %s" % rsp)