~apachelogger/software-properties/test

« back to all changes in this revision

Viewing changes to softwareproperties/ppa.py

  • Committer: Dimitri John Ledkov
  • Date: 2016-09-21 11:48:24 UTC
  • Revision ID: xnox@ubuntu.com-20160921114824-vsme41rnep1vcerk
Fix incorrect owner_name used by launchpad PPA info api. Fix online
testsuite in python3 and python2. Skip bad SSL test in python2, as
pycurl no longer raises an exception. Drop python3-pycurl dependency,
not used in python3 code path nor tests any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        return _get_https_content_py3(lp_url)
89
89
 
90
90
def get_ppa_info_from_lp(owner_name, ppa):
 
91
    if owner_name[0] != '~':
 
92
        owner_name = '~' + owner_name
91
93
    lp_url = LAUNCHPAD_PPA_API % (owner_name, ppa)
92
94
    return get_info_from_lp(lp_url)
93
95
 
129
131
        curl.setopt(pycurl.URL, str(lp_url))
130
132
        curl.setopt(pycurl.HTTPHEADER, ["Accept: application/json"])
131
133
        curl.perform()
 
134
        response = curl.getinfo(curl.RESPONSE_CODE)
132
135
        curl.close()
133
 
        json_data = callback.contents
 
136
        json_data = bodybuffer.getvalue()
134
137
    except pycurl.error as e:
135
138
        raise PPAException("Error reading %s: %s" % (lp_url, e), e)
 
139
    if response != 200:
 
140
        raise PPAException("Error reading %s: response code %i" % (lp_url, response))
136
141
    return json.loads(json_data)
137
142
 
138
143