Colin Watson has proposed merging
lp:~cjwatson/launchpad/explicit-proxy-bugzilla into lp:launchpad with
lp:~cjwatson/launchpad/explicit-proxy-mantis as a prerequisite.
Commit message:
Convert the Bugzilla external bug tracker to urlfetch.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/explicit-proxy-bugzilla/+merge/348432
I had to write a new XML-RPC transport that uses requests. It's a relatively
small variation on the urllib2-based one, and I'll delete that once I've
converted its other user.
--
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~cjwatson/launchpad/explicit-proxy-bugzilla into lp:launchpad.
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2018-06-05 12:18:58 +
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2018-06-23 00:58:53 +
@@ -51,9 +51,9 @@
The authorisation cookie will be stored in the auth_cookie property of
the XML-RPC transport.
->>> test_transport.cookie_processor.cookiejar
-<...CookieJar[Cookie(version=0, name='Bugzilla_login'...),
- Cookie(version=0, name='Bugzilla_logincookie'...)]>
+>>> test_transport.cookie_jar
+
Trying to log in to a Bugzilla instance for which we have no credentials
will raise an error:
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt 2018-06-05 12:18:58 +
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt 2018-06-23 00:58:53 +
@@ -78,9 +78,9 @@
The authorisation cookie will be stored in the auth_cookie property of
the XML-RPC transport.
->>> test_transport.cookie_processor.cookiejar
-<...CookieJar[Cookie(version=0, name='Bugzilla_login'...),
- Cookie(version=0, name='Bugzilla_logincookie'...)]>
+>>> test_transport.cookie_jar
+
The externalbugtracker.bugzilla module contains a decorator,
needs_authentication, which can be used to ensure that a
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2012-04-12 11:38:44 +
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2018-06-23 00:58:53 +
@@ -21,7 +21,9 @@
>>> txn = LaunchpadZopelessLayer.txn
>>> mozilla_bugzilla = getUtility(IBugTrackerSet).getByName('mozilla.org')
>>> issuezilla = TestIssuezilla(mozilla_bugzilla.baseurl)
->>> issuezilla._probe_version()
+>>> transaction.commit()
+>>> with issuezilla.responses(post=False):
+... issuezilla._probe_version()
(2, 11)
>>> for bug_watch in mozilla_bugzilla.watches:
... print "%s: %s %s" % (bug_watch.remotebug,
@@ -32,8 +34,9 @@
42: FUBAR BAZBAZ
>>> transaction.commit()
>>> bug_watch_updater = CheckwatchesMaster(txn, logger=FakeLogger())
->>> bug_watch_updater.updateBugWatches(
-... issuezilla, mozilla_bugzilla.watches)
+>>> with issuezilla.responses():
+... bug_watch_updater.updateBugWatches(
+... issuezilla, mozilla_bugzilla.watches)
INFO Updating 4 watches for 3 bugs on https://bugzilla.mozilla.org
INFO Didn't find bug u'42' on https://bugzilla.mozilla.org
(local bugs: 1, 2).
@@ -58,7 +61,9 @@
a) The version is way old:
->>> old_bugzilla._probe_version()
+>>> transaction.commit()
+>>> with old_bugzilla.responses(post=False):
+... old_bugzilla._probe_version()
(2, 10)
b) The tags are not prefixed with the bz: namespace:
@@ -72,7 +77,8 @@
We support them just fine:
>>> remote_bugs = ['42', '123543']
->>> old_bugzilla.initializeRemoteBugDB(remote_bugs)
+>>> with old_bugzilla.responses():
+... old_bugzilla.initializeRemoteBugDB(remote_bugs)
>>> for remote_bug in remote_bugs:
... print "%s: %s %s" % (
... remote_bug,
@@ -90,7 +96,9 @@
>>> from lp.bugs.tests.externalbugtracker import (
... TestWeirdBugzilla)
>>> weird_bugzilla = TestWeirdBugzilla(mozilla_bugzilla.baseurl)
->>> weird_bugzilla._probe_version()
+>>> transaction.commit()
+>>> with weird_bugzilla.responses(post=False):
+... weird_bugzilla._probe_version()
(2, 20)
a) The bug status tag is and not
@@ -109,7 +117,8 @@
Yet everything still works as expected:
>>> remote_bugs = ['2000', '123543']
->>> weird_bugzilla.initializeRemoteBugDB(remote_bugs)
+>>> with weird_bugzilla.responses():
+... weird_bugzilla.initializeRemoteBugDB(remote_bugs)
>>> for remote_bug in remote_bugs:
... print "%s: %s %s" % (
... remote_bug,
@@ -128,13 +137,16 @@
>>> from lp.bugs.tests.externalbugtracker import (
... TestBrokenBugzilla)
>>> broken_bugzilla =